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