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