Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.ajax({
- url: "/api/GuestPartyAPI/" + cerid,
- type: "GETAD",
- async: false,
- data: { Id: id, Name: name, NeedsHotel: needshotel_bool, TableNo: tableno, QR_CodeImage: qrcodeimage,
- AddressLabel: addresslabel, Address_1: address1, Address_2: address2, City: city, State: state,
- PostalCode: postalcode, Country: country, Email: email, Phone: phone
- },
- dataType: "json"
- }).fail(function (jqXHR, textStatus) {
- console.log(jqXHR);
- console.log(textStatus);
- //alert("cerid " + cerid);
- //alert("Request failed: " + textStatus);
- });
- [AcceptVerbs("GETAD")]
- public HttpResponseMessage GetGuestPartyCer(int cerid, GuestParty guestparty)
- {
- if (ModelState.IsValid)
- {
- db.GuestParties.AddObject(guestparty);
- db.SaveChanges();
- CeremonyGuestParty ceremonygp = new CeremonyGuestParty(); //create a CeremonyGuestParty entry to link ceremony and guestparty
- ceremonygp.CeremonyId = cerid;
- ceremonygp.GuestPartyId = guestparty.Id;
- db.CeremonyGuestParties.AddObject(ceremonygp);
- db.SaveChanges();
- HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, guestparty);
- response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = guestparty.Id }));
- return response;
- }
- else
- {
- return Request.CreateResponse(HttpStatusCode.BadRequest);
- }
- }
- config.Routes.MapHttpRoute(
- name: "DefaultApi",
- routeTemplate: "api/{controller}/{id}",
- defaults: new { id = RouteParameter.Optional }
- );
- public HttpResponseMessage GetGuestPartyCer(int id, GuestParty guestparty)
Add Comment
Please, Sign In to add comment