Ejemplo n.º 1
0
        public IActionResult GetPerson(FindPersonViewModel findPersonViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            // Создание конфигурации сопоставления
            var config = new MapperConfiguration(cfg => cfg.CreateMap <PFRStorage, FindPFRStorageViewModel>());
            // Настройка AutoMapper
            var mapper = new Mapper(config);
            // сопоставление

            var query = _db.PfrStorages.Where(storage => (
                                                  (storage.Person.FirstName == findPersonViewModel.FirstName) &&
                                                  (storage.Person.SecondName == findPersonViewModel.SecondName) &&
                                                  (storage.Person.MiddleName == findPersonViewModel.MiddleName) &&
                                                  (storage.Person.SNILS == findPersonViewModel.SNILS)
                                                  ));

            if (query.Count() == 0)
            {
                return(PartialView("PersonNotFound"));
            }

            var storages = mapper.Map <List <FindPFRStorageViewModel> >(query);

            return(PartialView("PersonInfo", storages));
        }
Ejemplo n.º 2
0
 public FindPersonWindow(IDataService dataService)
 {
     InitializeComponent();
     _dataService = dataService;
     _model       = (FindPersonViewModel)DataContext;
 }