ویومدل مربوط به درج سابقه کاری
        public virtual async Task<ActionResult> Create(AddWorkExperienceViewModel viewModel)
        {
            if (!_referentialTeacherService.CanManageTeacher(viewModel.TeacherId)) return HttpNotFound();
            if (!ModelState.IsValid)
            {
               await _workExperienceService.FillAddViewModel(viewModel, IranCitiesPath);
                return new JsonNetResult
                {
                    Data = new
                    {
                        success = false,
                        View = this.RenderPartialViewToString(MVC.WorkExperience.Views._Create, viewModel)
                    }
                };

            }
          var newWork=await  _workExperienceService.Create(viewModel);
            
            return new JsonNetResult
            {
                Data = new
                {
                    success = true,
                    View = this.RenderPartialViewToString(MVC.WorkExperience.Views._WorkExperienceItem, newWork)
                }
            };
        }
Example #2
0
 public async Task<WorkExperienceViewModel> Create(AddWorkExperienceViewModel viewModel)
 {
     var workExperience = _mappingEngine.Map<WorkExperience>(viewModel);
     _workExperiences.Add(workExperience);
     await _unitOfWork.SaveChangesAsync();
     return await GetWorkExperienceViewModel(workExperience.Id);
 }
 public async Task FillAddViewModel(AddWorkExperienceViewModel viewModel,string path)
 {
     viewModel.States = _stateService.GetAsSelectListItemAsync(viewModel.State, path);
     viewModel.Cities = _cityService.GetAsSelectListByStateNameAsync(viewModel.State, viewModel.City, path);
     viewModel.Titles = await _titleService.GetAsSelectListItemAsync(TitleType.OrganizationPostTitle, viewModel.TitleId);
 }
Example #4
0
 public async Task FillAddViewModel(AddWorkExperienceViewModel viewModel, string path)
 {
     viewModel.States = _stateService.GetAsSelectListItemAsync(viewModel.State, path);
     viewModel.Cities = _cityService.GetAsSelectListByStateNameAsync(viewModel.State, viewModel.City, path);
 }