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