public async Task <IActionResult> Edit(int id, [Bind("HamperCategoryId,HamperCategoryName,Description,Discontinued")] HamperCategory hamperCategory) { if (id != hamperCategory.HamperCategoryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(hamperCategory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HamperCategoryExists(hamperCategory.HamperCategoryId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(hamperCategory)); }
public async Task <IActionResult> Create([Bind("HamperCategoryId,HamperCategoryName,Description,Discontinued")] HamperCategory hamperCategory) { if (ModelState.IsValid) { _context.Add(hamperCategory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(hamperCategory)); }