Example #1
0
        public ActionResult CreateRoom(int hotelID, int quality)
        {
            var hotel = hotelRepository.GetById(hotelID);

            using (var trs = transactionScopeProvider.CreateTransactionScope())
            {
                var result = hotelService.CanBuildNewRoom(hotel, quality, SessionHelper.CurrentEntity);
                if (result.IsError)
                {
                    return(RedirectBackWithError(result));
                }

                hotelService.BuildRoom(hotel, quality);
                trs.Complete();
            }

            return(RedirectToAction("Rooms", "Hotel", new { hotelID = hotelID }));
        }