public virtual ActionResult Distribute(string userId) { if (!Accounting.CanDistributeBudget(CurrentUser, UserSummaries[userId])) { throw new HttpException((int)HttpStatusCode.Forbidden, "You cannot distribute points to this user."); } var employee = Users[userId]; var model = BudgetDistributionViewModel.Create( CurrentBudget, employee, Accounting.GetPointsLedger(employee)); //return Request.IsAjaxRequest() ? (ActionResult)Json(model, JsonRequestBehavior.AllowGet) : PartialView(model); return(PartialView(model)); }
public virtual ActionResult Distribute(string id, BudgetDistributionModel model) { if (!Accounting.CanDistributeBudget(CurrentUser, UserSummaries[id])) { throw new HttpException((int)HttpStatusCode.Forbidden, "You cannot distribute points to this user."); } if (null == model.Amount || 0 == model.Amount || String.IsNullOrEmpty(model.Message)) { return(Index()); } Accounting.CreateBudgetTransfer( CurrentUser, Users[id], model.Amount ?? 0, model.Message); return(Index()); }