public async Task <IActionResult> Create(Mares mares) { if (ModelState.IsValid) { _db.Add(mares); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(mares)); }
public async Task <IActionResult> Edit(int id, Mares mares) { if (id != mares.Id) { return(NotFound()); } if (ModelState.IsValid) { _db.Update(mares); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(mares)); }