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