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