public async Task <IActionResult> Edit(EditEvalViewModel model) { if (!this.ModelState.IsValid) { return(this.View(model)); } await this.evaluationService.UpdateAsync(model); return(this.RedirectToAction("Index")); }
public async Task UpdateAsync(EditEvalViewModel model) { var evalToEdit = await this.evaluationRepository.GetByIdAsync(model.Id); if (evalToEdit == null) { throw new NullReferenceException("Eval for edit is not found"); } evalToEdit.Notes = model.Notes; evalToEdit.Value = model.Value; evalToEdit.EvaluationYear = model.Year; evalToEdit.ModifiedOn = DateTime.UtcNow; this.evaluationRepository.Update(evalToEdit); await this.evaluationRepository.SaveChangesAsync(); }