コード例 #1
0
        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 }));
        }
コード例 #2
0
 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();
 }
コード例 #3
0
        // 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"));
        }