public async Task <IActionResult> Create(MedicalItemViewModel medicalItemViewModel) { if (!ModelState.IsValid) { return(View(medicalItemViewModel)); } await _repository.AddAsync(medicalItemViewModel.MedicalItem); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Edit(MedicalItemViewModel medicalItemViewModel) { if (ModelState.IsValid) { try { await _repository.UpdateAsync(medicalItemViewModel.MedicalItem); } catch (DbUpdateConcurrencyException) { if (!MedicalItemExists(medicalItemViewModel.MedicalItem.MedItemId)) { return(NotFound()); } throw; } return(RedirectToAction(nameof(Index))); } return(View(medicalItemViewModel)); }