public virtual async Task <ActionResult> Edit(EditEducationalBackgroundViewModel viewModel) { if (!await _educationalBackgroundService.IsInDb(viewModel.Id)) { this.AddErrors("TitleId", "سابقه تحصیلی مورد نظر توسط یکی از کاربران در شبکه،حذف شده است"); } if (!ModelState.IsValid) { return(View(viewModel)); } await _educationalBackgroundService.EditAsync(viewModel); await _unitOfWork.SaveAllChangesAsync(auditUserId : _userManager.GetCurrentUserId()); return(RedirectToAction(MVC.EducationalBackground.List(viewModel.ApplicantId))); }
public async Task EditAsync(EditEducationalBackgroundViewModel viewModel) { var educationalBackground = await _educationalBackgrounds.FirstAsync(a => a.Id == viewModel.Id); _mappingEngine.Map(viewModel, educationalBackground); }