public ActionResult Login(Guest guest) { var phoneId = guest.PhoneId; if (!string.IsNullOrEmpty(phoneId)) phoneId = phoneId.Trim(); Guest jsonGuest = _dbContext.GetGuest(phoneId); if (jsonGuest != null) { return Json(new { Result = "Success", JsonGuest = _serializer.Serialize(jsonGuest) }, JsonRequestBehavior.AllowGet); } return Json(new { Result = "Error" }, JsonRequestBehavior.AllowGet); }
public void UpdateGuest(Guest guest) { XElement element = _xdoc.Descendants("Guest").FirstOrDefault(x => x.Element("PhoneId").Value == guest.PhoneId.ToString()); if (element != null) { element.Element("IsConfirmed").Value = guest.IsConfirmed.ToString(); element.Element("ConfirmedAdultCount").Value = guest.ConfirmedAdultCount.ToString(); element.Element("ConfirmedChildrenCount").Value = guest.ConfirmedChildrenCount.ToString(); element.Element("ConfirmedInfantCount").Value = guest.ConfirmedInfantCount.ToString(); } _xdoc.Save(Path.Combine(HostingEnvironment.ApplicationPhysicalPath, @"App_Data\GuestData.xml")); }
public ActionResult Confirm(Guest guest) { var result = "Success"; try { _dbContext.UpdateGuest(guest); } catch (Exception) { result = "Error"; } return Json(new { Result = result }, JsonRequestBehavior.AllowGet); }