public async Task <IActionResult> Create([Bind("ID,Name")] PurchaseCategory purchaseCategory) { if (ModelState.IsValid) { _context.Add(purchaseCategory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(purchaseCategory)); }
public async Task <IActionResult> Create([Bind("ID,Name,FullName,ValidThru,Balance,Group")] PaySource paySource) { if (ModelState.IsValid) { _context.Add(paySource); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(paySource)); }
public async Task <IActionResult> Create([Bind("ID,TimeStamp,Sum,Purchase,PaySourceID,CategoryID")] Expense expense) { if (ModelState.IsValid) { _context.Add(expense); Helpers.Money.Spend(_context, expense); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } PopulateCategoryDropDownList(); PopulatePaySourceDropDownList(); return(View(expense)); }
public async Task <IActionResult> Create([Bind("ID,TimeStamp,Sum,Income,MonthlyIncome,PaySourceID")] Inpayment inpayment) { if (ModelState.IsValid) { _context.Add(inpayment); Helpers.Money.Earn(_context, inpayment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PaySourceID"] = new SelectList(_context.PaySources, "ID", "ID", inpayment.PaySourceID); PopulateCategoryDropDownList(); PopulatePaySourceDropDownList(); return(View(inpayment)); }