public async Task <IActionResult> Edit(int id, TypeNotable typeNotable) { if (id != typeNotable.Id) { ViewBag.ErrorMessage = "لايوجد بيانات"; return(View("NotFound")); } if (ModelState.IsValid) { try { _repository.Update <TypeNotable>(typeNotable); await _repository.SavaAll(); } catch (DbUpdateConcurrencyException) { if (_repository.GetTypeNotable(typeNotable.Id) == null) { ViewBag.ErrorMessage = "لايوجد بيانات"; return(View("NotFound")); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(typeNotable)); }
public async Task <IActionResult> Create(TypeNotable typeNotable) { if (ModelState.IsValid) { _repository.Add <TypeNotable>(typeNotable); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } return(View(typeNotable)); }