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