public async Task <IActionResult> Edit(string id, [Bind("ID,testCode,Description,Price,Category")] labTest labTest) { if (id != labTest.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(labTest); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!labTestExists(labTest.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(labTest)); }
public async Task <IActionResult> Create([Bind("ID,testCode,Description,Price,Category")] labTest labTest) { if (ModelState.IsValid) { _context.Add(labTest); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(labTest)); }