public async Task <IActionResult> Edit(int id, [Bind("CowCollectionId,CowCollectionName,ManagerSignature,EntryDate")] CowCollection cowCollection) { if (id != cowCollection.CowCollectionId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cowCollection); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CowCollectionExists(cowCollection.CowCollectionId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(cowCollection)); }
public async Task <IActionResult> Create([Bind("CowCollectionId,CowCollectionName,ManagerSignature,EntryDate")] CowCollection cowCollection) { if (ModelState.IsValid) { _context.Add(cowCollection); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(cowCollection)); }