Ejemplo n.º 1
0
        public JsonResult UpdateFieldStatus(int id, string field, int included, double taxrate)
        {
            if (!AuthorizationProvider.CanEditRevenue())
            {
                return(Forbidden());
            }

            try
            {
                var provider = new ReservationRevenueProvider(_dbContext);
                var ok       = provider.SetFieldStatus(id, field, taxrate, (included == 1 ? true : false));
                if (ok)
                {
                    return(Json(id, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(string.Empty, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                string message = string.Format("Change Reservation 'IncludeInStatement' for ID = {0:d} fails. {1}", id, ex.Message + ex.StackTrace);
                return(InternalError(message, string.Empty, ex));
            }
        }