ویو مدل درج متقاضی
Esempio n. 1
0
        public async Task FillAddViewMoel(AddApplicantViewModel viewModel, string path)
        {
            viewModel.StatesForBirthPlace = viewModel.BirthPlaceState == null
                ? new List<SelectListItem>()
                : _stateService.GetAsSelectListItemAsync(viewModel.BirthPlaceState, path);


            viewModel.CitiesForBirthPlace = viewModel.BirthPlaceState == null
                ? new List<SelectListItem>()
                : viewModel.BirthPlaceCity == null
                    ? new List<SelectListItem>()
                    : _cityService.GetAsSelectListByStateNameAsync(viewModel.BirthPlaceState,
                        viewModel.BirthPlaceCity, path);
        }
Esempio n. 2
0
 public async Task<AddApplicantViewModel> GetForCreate(string path)
 {
     var viewModel = new AddApplicantViewModel
     {
         StatesForBirthPlace = _stateService.GetAsSelectListItemAsync(null, path)
     };
     return viewModel;
 }
Esempio n. 3
0
        public void Create(AddApplicantViewModel viewModel)
        {
            var applicant = _mappingEngine.Map<Applicant>(viewModel);

            if (viewModel.PhotoScan.HasValue())
                applicant.Photo = Convert.FromBase64String(viewModel.PhotoScan).ResizeImageFile(150, 150);
            else if (viewModel.PhotoFile.HasFile())
            {
                applicant.Photo = viewModel.PhotoFile.InputStream.ResizeImageFile(150, 150);
            }
            else
            {
                applicant.Photo = ImageManage.ResizeImageFile(_httpContextBase.Server.MapPath(DefaultAvatarPath), 150, 150);
            }

            if (viewModel.CopyOfBirthCertificateScan.HasValue())
                applicant.CopyOfBirthCertificate = Convert.FromBase64String(viewModel.CopyOfBirthCertificateScan).ResizeImageFile(A5Width, A5Height);
            else if (viewModel.CopyOfBirthCertificateFile.HasFile())
            {
                applicant.CopyOfBirthCertificate = viewModel.CopyOfBirthCertificateFile.InputStream.ResizeImageFile(A5Width, A5Height);
            }

            if (viewModel.CopyOfNationalCardScan.HasValue())
                applicant.CopyOfNationalCard = Convert.FromBase64String(viewModel.CopyOfNationalCardScan).ResizeImageFile(A6Width, A6Height);
            else if (viewModel.CopyOfNationalCardFile.HasFile())
            {
                applicant.CopyOfNationalCard = viewModel.CopyOfNationalCardFile.InputStream.ResizeImageFile(A6Width, A6Height);
            }
            _applicants.Add(applicant);
        }