ویومدل درج سوابق متقاضی
        public virtual async Task<ActionResult> Create(AddEducationalBackgroundViewModel viewModel)
        {

            if (!ModelState.IsValid)
            {

                return new JsonNetResult
                {
                    Data = new
                    {
                        success = false,
                        View = this.RenderPartialViewToString(MVC.EducationalBackground.Views._Create, viewModel)
                    }
                };
            }
            var newbackground = await _educationalBackgroundService.Create(viewModel);

            return new JsonNetResult
            {
                Data = new
                {
                    success = true,
                    View = this.RenderPartialViewToString(MVC.EducationalBackground.Views._EducationalBackgroundItem, newbackground)
                }
            };
        }
        public async Task<EducationalBackgroundViewModel> Create(AddEducationalBackgroundViewModel viewModel)
        {
            var educationalBackground = _mappingEngine.Map<EducationalBackground>(viewModel);
           
            _educationalBackgrounds.Add(educationalBackground);
            await _unitOfWork.SaveAllChangesAsync(auditUserId:_userManager.GetCurrentUserId());

            return await _educationalBackgrounds
                .Include(a => a.CreatedBy)
                .Include(a => a.ModifiedBy)
                .AsNoTracking().ProjectTo<EducationalBackgroundViewModel>(_mappingEngine).FirstOrDefaultAsync();
        }
 public virtual ActionResult Create(Guid applicantId)
 {
     var viewModel = new AddEducationalBackgroundViewModel {ApplicantId = applicantId};
     return PartialView(MVC.EducationalBackground.Views._Create, viewModel);
 }
        public async  Task<EducationalBackgroundViewModel> Create(AddEducationalBackgroundViewModel viewModel)
        {
            var educationalBackground = _mappingEngine.Map<EducationalBackground>(viewModel);
            educationalBackground.CreatorId = _userManager.GetCurrentUserId();

            if (viewModel.AttachmentScan.HasValue())
                educationalBackground.Attachment = Convert.FromBase64String(viewModel.AttachmentScan).ResizeImageFile(a4Width, a4height);
            else if (viewModel.AttachmentFile.HasFile())
            {
                educationalBackground.Attachment
                    = viewModel.AttachmentFile.InputStream.ResizeImageFile(a4Width, a4height);
            }
            _educationalBackgrounds.Add(educationalBackground);
           await  _unitOfWork.SaveChangesAsync();

            return await _educationalBackgrounds
                .Include(a => a.Creator)
                .Include(a => a.LasModifier)
                .Include(a => a.StudyField)
                .Include(a => a.Institution)
                .AsNoTracking().ProjectTo<EducationalBackgroundViewModel>(_mappingEngine).FirstOrDefaultAsync();
        }
 public async  Task FillAddViewModel(AddEducationalBackgroundViewModel viewModel)
 {
     viewModel.StudyFields =
      await _titleService.GetAsSelectListItemAsync(TitleType.StudyField, viewModel.StudyFieldId);
     viewModel.Institutions = await _institutionService.GetAsSelectListItemAsync(viewModel.InstitutionId);
 }
        public virtual async Task<ActionResult> Create(AddEducationalBackgroundViewModel viewModel)
        {
            if (!_referentialTeacherService.CanManageTeacher(viewModel.TeacherId)) return HttpNotFound();

            if (!ModelState.IsValid)
            {
                await _educationalBackgroundService.FillAddViewModel(viewModel);

                return new JsonNetResult
                {
                    Data = new
                    {
                        success = false,
                        View = this.RenderPartialViewToString(MVC.EducationalBackground.Views._Create, viewModel)
                    }
                };
            }
          var newbackground=await  _educationalBackgroundService.Create(viewModel);
            
            return new JsonNetResult
            {
                Data = new
                {
                    success = true,
                    View = this.RenderPartialViewToString(MVC.EducationalBackground.Views._EducationalBackgroundItem, newbackground)
                }
            };
        }