public async Task <ActionResult> Add(WebUser user, DebtsAddModel model) { if (ModelState.IsValid) { var debt = new Debt() { DateBegin = DateTime.Now, Person = model.Person, TypeOfFlowId = model.TypeOfFlowId, AccountId = model.AccountId, Summ = model.Summ, UserId = user.Id }; try { await _debtService.CreateAsync(debt); } catch (ServiceException e) { throw new WebUiException($"Ошибка в контроллере {nameof(DebtController)} в методе {nameof(Add)}", e); } return(RedirectToAction("DebtList")); } model.Accounts = (await AccountList(user.Id)).ToList(); return(PartialView(model)); }
public async Task <ActionResult> Add(WebUser user) { var model = new DebtsAddModel() { Accounts = (await AccountList(user.Id)).ToList() }; return(PartialView(model)); }