Beispiel #1
0
        public ActionResult ConfirmRequest(int?aprtId, int?reqId)
        {
            if (ApartmentContainer.roomsForPickIds.Contains(aprtId.Value) && ApartmentContainer.requestId == reqId.Value)
            {
                try
                {
                    var request = Mapper.Map <RequestDTO, RequestViewModel>(requestService.GetRequest(reqId));

                    if (apartmentService.IsCorrectApartmentForPickedDate(aprtId, request.DateOfArrival, request.DaysOfStay))
                    {
                        requestService.ConfirmRequest(reqId.Value, aprtId.Value, User.Identity.GetUserId());
                    }
                    else
                    {
                        return(View("NoAvailableApartments"));
                    }
                }
                catch (ValidationException ex)
                {
                    // Залогировать эксепшн
                }

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View("IncorrectData"));
            }
        }