public ActionResult Edit([Bind(Include = "Id,GuestMail,RoomNumber,BookingDate,ArrivalDate,LeavingDate,PaymentMethod,OrderStatus")] OrdersRegistrationDTO ordersRegistration) { if (ModelState.IsValid) { ordersRegistration.OrderStatus = "Waiting for confirmation"; ordersService.Update(ordersRegistration); return(RedirectToAction("Index", "HotelRooms")); } return(RedirectToAction("Edit", new { login = ordersRegistration.GuestMail })); }
public void Create(OrdersRegistrationDTO order) { db.OrdersRegistration.Create(new OrdersRegistration { GuestMail = order.GuestMail, RoomNumber = order.RoomNumber, BookingDate = order.BookingDate, ArrivalDate = order.ArrivalDate, LeavingDate = order.LeavingDate, PaymentMethodCode = GetPaymentMethodCode(order.PaymentMethod), OrderStatus = GetStatusCode(order.OrderStatus) }); db.Save(); }
// GET: OrdersRegistrations/Create public ActionResult Create(int roomNumber) { string profileName = Request.Cookies["Login"].Value; if (!ordersService.IsExists(profileName)) { var order = new OrdersRegistrationDTO() { GuestMail = profileName, RoomNumber = roomNumber, BookingDate = DateTime.Now, ArrivalDate = DateTime.Now, LeavingDate = DateTime.Now, PaymentMethod = "Cash", OrderStatus = "Forming" }; ordersService.Create(order); return(RedirectToAction("Edit", new { login = profileName })); } return(RedirectToAction("Index", "HotelRooms")); }