예제 #1
0
        public JsonResult DeleteRevenue(int id)
        {
            if (!AuthorizationProvider.CanEditRevenue())
            {
                return(Forbidden());
            }

            try
            {
                var dataProvider = new ReservationRevenueProvider(_dbContext);
                var entity       = dataProvider.Retrieve(id);

                dataProvider.Delete(id);
                dataProvider.Commit();

                var provider = new OwnerPayoutProvider(_dbContext);
                provider.UpdateOwnerPayoutMatchStatus(entity.OwnerPayoutId);

                return(Json("success", JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                string message = string.Format("Delete Reservation {0} fails. {1}", id.ToString(), ex.Message + ex.StackTrace);
                return(InternalError(message, "fail", ex));
            }
        }