public ActionResult <BookingDto> CreateBooking([FromBody] BookingDto bookingCreateDto) { var bookingModel = _mapper.Map <Booking>(bookingCreateDto); _repository.CreateBooking(bookingModel); _repository.SaveChanges(); var bookingDto = _mapper.Map <BookingDto>(bookingModel); return(CreatedAtRoute(nameof(GetBookingById), new { bookingDto.Id }, bookingDto)); }
public IActionResult SaveInfo(AccountView customer, int Cusage) { if (CookieSupport.CheckCookieExists(HttpContext, CookieSupport.InfoBooking)) { BookingView infoBooking = JsonConvert.DeserializeObject <BookingView>(HttpContext.Request.Cookies[CookieSupport.InfoBooking]); customer.Description = AgeCal(Cusage); var accid = _IAcc.CreateCustomer(customer); if (accid > 0) { infoBooking.UserId = accid; int bookid = _IBook.CreateBooking(infoBooking); } } return(View()); }