public virtual async Task<ActionResult> Edit(EditResearchExperienceViewModel viewModel)
        {
            if (!_referentialTeacherService.CanManageTeacher(viewModel.TeacherId)) return HttpNotFound();
            if (!await _researchExperienceService.IsInDb(viewModel.Id))
                this.AddErrors("Title", "سابقه پژوهشی مورد نظر توسط یکی از کاربران در شبکه،حذف شده است");

            if (!ModelState.IsValid)
            {
                return new JsonNetResult
                {
                    Data = new
                    {
                        success = false,
                        View =
                            this.RenderPartialViewToString(MVC.ResearchExperience.Views._Edit, viewModel)
                    }
                };
            }

            await _researchExperienceService.EditAsync(viewModel);
            var message = await _unitOfWork.ConcurrencySaveChangesAsync();
            if (message.HasValue()) this.AddErrors("Title", string.Format(message, "سابقه پژوهشی"));

            if (!ModelState.IsValid)
                return new JsonNetResult
                {
                    Data = new
                    {
                        success = false,
                        View =
                            this.RenderPartialViewToString(MVC.ResearchExperience.Views._Edit, viewModel)
                    }
                };

            var research = await _researchExperienceService.GetResearchExperienceViewModel(viewModel.Id);
            return new JsonNetResult
            {
                Data = new
                {
                    success = true,
                    View =
                        this.RenderPartialViewToString(MVC.ResearchExperience.Views._ResearchExperienceItem, research)
                }
            };
        }
 public async Task EditAsync(EditResearchExperienceViewModel viewModel)
 {
     var researchExperience = await _researchExperiences.FirstAsync(a => a.Id == viewModel.Id);
     _mappingEngine.Map(viewModel, researchExperience);
     researchExperience.LasModifierId = _userManager.GetCurrentUserId();
 }
        public virtual async Task<ActionResult> Edit(EditResearchExperienceViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return new JsonNetResult
                {
                    Data = new
                    {
                        success = false,
                        View =
                            this.RenderPartialViewToString(MVC.ResearchExperience.Views._Edit, viewModel)
                    }
                };
            }

            await _researchExperienceService.EditAsync(viewModel);
            await _unitOfWork.SaveAllChangesAsync();

            var research = await _researchExperienceService.GetResearchExperienceViewModel(viewModel.Id);
            return new JsonNetResult
            {
                Data = new
                {
                    success = true,
                    View =
                        this.RenderPartialViewToString(MVC.ResearchExperience.Views._ResearchExperienceItem, research)
                }
            };
        }
 public async Task EditAsync(EditResearchExperienceViewModel viewModel)
 {
     var researchExperience = await _researchExperiences.FirstAsync(a => a.Id == viewModel.Id);
     _mappingEngine.Map(viewModel, researchExperience);
 }