public ActionResult Add(HotelManageModel model) { try { if (ModelState.IsValid) { string jsonStr = JsonConvert.SerializeObject(model.Hotel); string result = objAPI.PostRecordtoApI("hotelconfig", "savehotel", jsonStr); TempData["ErrMsg"] = result; if (result.ToLower().Contains("error")) { model.Destinations = objAPI.GetAllRecords <utblMstDestination>("configuration", "alldestinations"); model.HotelTypes = objAPI.GetAllRecords <utblMstHotelType>("hotelconfig", "hoteltypes"); return(View(model)); } return(RedirectToAction("index", "hotel", new { Area = "admin" })); } model.Destinations = objAPI.GetAllRecords <utblMstDestination>("configuration", "alldestinations"); model.HotelTypes = objAPI.GetAllRecords <utblMstHotelType>("hotelconfig", "hoteltypes"); return(View(model)); } catch (AuthorizationException) { TempData["ErrMsg"] = "Your Login Session has expired. Please Login Again"; return(RedirectToAction("Login", "Account", new { Area = "" })); } }
public ActionResult Edit(long id) { try { utblMstHotel hotel = objAPI.GetObjectByKey <utblMstHotel>("hotelconfig", "hotelbyid", id.ToString(), "id"); var hoteltypes = objAPI.GetRecordsByQueryString <long>("hotelconfig", "HotelTypesOfHotel", "id=" + id); HotelManageModel model = new HotelManageModel(); model.Hotel = new HotelSaveModel() { HotelID = hotel.HotelID, DestinationID = hotel.DestinationID, HotelName = hotel.HotelName, HotelAddress = hotel.HotelAddress, HotelContact = hotel.HotelContact, HotelEmail = hotel.HotelEmail, HotelTypes = hoteltypes }; model.Destinations = objAPI.GetAllRecords <utblMstDestination>("configuration", "alldestinations"); model.HotelTypes = objAPI.GetAllRecords <utblMstHotelType>("hotelconfig", "hoteltypes"); return(View(model)); } catch (AuthorizationException) { TempData["ErrMsg"] = "Your Login Session has expired. Please Login Again"; return(RedirectToAction("Login", "Account", new { Area = "" })); } }
public ActionResult Add() { try { HotelManageModel model = new HotelManageModel(); model.Destinations = objAPI.GetAllRecords <utblMstDestination>("configuration", "alldestinations"); model.HotelTypes = objAPI.GetAllRecords <utblMstHotelType>("hotelconfig", "hoteltypes"); return(View(model)); } catch (AuthorizationException) { TempData["ErrMsg"] = "Your Login Session has expired. Please Login Again"; return(RedirectToAction("Login", "Account", new { Area = "" })); } }