public async Task <IActionResult> Edit(Guid id, [Bind("ID,Name")] MotorMake motorMake) { if (id != motorMake.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(motorMake); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MotorMakeExists(motorMake.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(motorMake)); }
public async Task <IActionResult> Create([Bind("ID,Name")] MotorMake motorMake) { if (ModelState.IsValid) { motorMake.ID = Guid.NewGuid(); _context.Add(motorMake); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(motorMake)); }