public async Task <Response <bool> > AddHotel(Model.Add.Hotel hotel) { var response = _repository.AddHotel(hotel); if (response > 0) { return(new Response <bool>(true)); } if (response == -1) { return(new Response <bool>(false, Infrastructure.Utils.Enums.ResponseCodes.AlreadyExist, "Hotel Already Exists")); } return(new Response <bool>(false, Infrastructure.Utils.Enums.ResponseCodes.BadRequest, "Saving of Hotel information failed.")); }
public ActionResult Create(EditHotelViewModel ehvm) { //if (ModelState.IsValid) { try { Hotel h = new Hotel(); hotelRepo.AddHotel(h); Context x = hotelRepo.getContext(); MapToHotel(ehvm, h, x); x.SaveChanges(); TempData["message"] = String.Format("Hotel {0} werd gecreƫerd", h.Name); return(RedirectToAction("Index")); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); } } // http policy requires to fill the list again after the post ehvm.Branch = branchRepo.FindAll().Select(t => new SelectListItem { Value = t.Name, Text = t.Name }); ehvm.ContactPerson = contactRepo.FindAll().Select(t => new SelectListItem { Value = t.ContactPersonId.ToString(), Text = t.LastName + " " + t.FirstName }); ehvm.Owner = ownerRepo.FindAll().Select(t => new SelectListItem { Value = t.OwnerId.ToString(), Text = t.LastName + " " + t.FirstName }); ehvm.Status = statusRepo.FindAll().Select(t => new SelectListItem { Value = t.St, Text = t.St }); return(View("Create", ehvm)); }
public void AddHotel(Hotel hotel) { hotelRepository.AddHotel(hotel); }
public bool AddHotel(HotelModel hotel) { return(HotelRepository.AddHotel(ModelMapperService.Map <HotelModel, Hotel>(hotel))); }
public HotelViewModel AddHotel(HotelViewModel hvmodel) { var data = _hotelRepository.AddHotel(hvmodel); return(data); }
public ActionResult <string> Post([FromBody] string hotelname) { _hotelRepository.AddHotel(hotelname); return(Ok("Your hotel was created")); }
public JsonResult AddHotel(HotelModel model) { string data = repository.AddHotel(model); return(Json(data, JsonRequestBehavior.AllowGet)); }
public async Task <ActionResult <Hotel> > PostHotel(Hotel hotel) { await hotelRepository.AddHotel(hotel); return(CreatedAtAction("GetHotel", new { id = hotel.ID }, hotel)); }
public Hotel AddHotel(Hotel hotel) { return(_hotelRepository.AddHotel(hotel)); }