public async Task <IActionResult> Create([Bind("ExpenseTypeId,ExpenseName,Comment")] ExpenseType source) { if (ModelState.IsValid) { context.Add(source); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(source)); }
public async Task <IActionResult> Create([Bind("IncomeId,IncomeSourceId,Amount,IncomeDate")] Income income) { if (ModelState.IsValid) { context.Add(income); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IncomeSourceId"] = new SelectList(context.IncomeSources, "IncomeSourceId", "IncomeName", income.IncomeSourceId); return(View()); }
public async Task <IActionResult> Create([Bind("ExpenseId,ExpenseTypeId,Amount,ExpenseDate")] Expense expense) { if (ModelState.IsValid) { context.Add(expense); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ExpenseTypeId"] = new SelectList(context.ExpenseTypes, "ExpenseTypeId", "ExpenseName", expense.ExpenseTypeId); return(View()); }
public async Task <IActionResult> Create([Bind("MemberId,Fio,Sex,Age,Phone,IncomeId,ExpenseId,Balance")] FamilyMember familyMember) { if (ModelState.IsValid) { context.Add(familyMember); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ExpenseId"] = new SelectList(context.Expenses.Include(c => c.ExpenseType), "ExpenseId", "ExpenseType.ExpenseName", familyMember.ExpenseId); ViewData["IncomeId"] = new SelectList(context.Incomes.Include(c => c.IncomeSource), "IncomeId", "IncomeSource.IncomeName", familyMember.IncomeId); return(View()); }