public ActionResult TetrisRevenue(int Id) { if (!AuthorizationProvider.CanEditRevenue()) { return(Forbidden()); } var model = new ResevationTetrisModel(); var provider = new ReservationRevenueProvider(_dbContext); model.OldPropertyCode = provider.GetPropertyCodeById(Id); model.ReservationId = Id; ViewBag.Title = "Change Reservation"; return(PartialView("_ReservationTetrisPartial", model)); }
public JsonResult ChangePropertyCode(ResevationTetrisModel form) { if (!AuthorizationProvider.CanEditRevenue()) { return(Forbidden()); } try { var dataProvider = new ReservationRevenueProvider(_dbContext); var entity = dataProvider.Retrieve(form.ReservationId); entity.PropertyCode = form.NewPropertyCode; dataProvider.Update(form.ReservationId, entity); dataProvider.Commit(); return(Json(form.ReservationId.ToString(), JsonRequestBehavior.AllowGet)); } catch (Exception ex) { var innerErrorMessage = ex.InnerException != null ? ex.InnerException.Message : string.Empty; string message = string.Format("Changing Reservation {0:d} property code to {1} fails. {2},{3}", form.ReservationId, form.NewPropertyCode, ex.Message, innerErrorMessage); return(InternalError(message, string.Empty, ex)); } }