public async Task <IActionResult> Edit(int id, [Bind("Id,ReceiptCategoryName")] ReceiptCategory receiptCategory) { if (id != receiptCategory.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(receiptCategory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReceiptCategoryExists(receiptCategory.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(receiptCategory)); }
public async Task <IActionResult> Create([Bind("Id,ReceiptCategoryName")] ReceiptCategory receiptCategory) { if (ModelState.IsValid) { _context.Add(receiptCategory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(receiptCategory)); }