コード例 #1
0
 public ActionResult Edit(HotelEditModel model)
 {
     if (ModelState.IsValid)
     {
         var hotel = _hotelEditCommand.Execute(model);
         return(RedirectToAction("Details", new { id = hotel.Id }));
     }
     return(View(model));
 }
コード例 #2
0
 public ActionResult Create(ReservationCreateModel model)
 {
     if (ModelState.IsValid)
     {
         var reservation = _reservationCreateCommand.Execute(model);
         return(RedirectToAction("Details", new { id = reservation.Id }));
     }
     return(View(model));
 }
コード例 #3
0
 public ActionResult Edit(PositionEditModel model)
 {
     if (ModelState.IsValid)
     {
         var position = _positionEditCommand.Execute(model);
         return(RedirectToAction("Details", new { id = position.Id }));
     }
     return(View(model));
 }
コード例 #4
0
 public ActionResult Edit(VisitorEditModel model)
 {
     if (ModelState.IsValid)
     {
         var visitor = _visitorEditCommand.Execute(model);
         return(RedirectToAction("Details", new { id = visitor.Id }));
     }
     return(View(model));
 }
コード例 #5
0
 public ActionResult Edit(RoomEditModel model)
 {
     if (ModelState.IsValid)
     {
         var room = _roomEditCommand.Execute(model);
         return(RedirectToAction("Details", new { id = room.Id }));
     }
     return(View(model));
 }
コード例 #6
0
 public ActionResult Create(WorkerCreateModel model)
 {
     if (ModelState.IsValid)
     {
         var worker = _workerCreateCommand.Execute(model);
         return(RedirectToAction("Details", new { id = worker.Id }));
     }
     return(View(model));
 }
コード例 #7
0
        public ActionResult Create(HotelCreateModel model)
        {
            bool allEmpty = string.IsNullOrEmpty(model.Boss?.FirstName) &&
                            string.IsNullOrEmpty(model.Boss?.SecondName) &&
                            string.IsNullOrEmpty(model.Boss?.MiddleName) &&
                            string.IsNullOrEmpty(model.Boss?.IndividualId);
            bool allFilled = !string.IsNullOrEmpty(model.Boss?.FirstName) &&
                             !string.IsNullOrEmpty(model.Boss.SecondName) &&
                             !string.IsNullOrEmpty(model.Boss.MiddleName) &&
                             !string.IsNullOrEmpty(model.Boss.IndividualId);

            if (!allEmpty && !allFilled)
            {
                return(View(model));
            }

            if (ModelState.IsValid)
            {
                var hotel = _hotelCreateCommand.Execute(model);
                return(RedirectToAction("Details", new { id = hotel.Id }));
            }
            return(View(model));
        }