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