Ejemplo n.º 1
0
        public async Task <IActionResult> EmergencyContact()
        {
            var contact = await _accountManageService.GetEmergencyContactAsync(User.Identity.Name);

            var countries = _mapper.Map <List <CountryViewModel> >(await _nomenclatureService.GetCountries());
            var cities    = _mapper.Map <List <CityViewModel> >(await _nomenclatureService.GetCitiesByCountryId(countries[0].Id));

            if (contact == null)
            {
                contact = new EmergencyContactServiceModel();
            }

            var model = _mapper.Map <EmergencyContactViewModel>(contact);

            model.Countries = countries;

            if (contact.Location == null)
            {
                model.Cities = cities;
            }
            else
            {
                model.Cities    = _mapper.Map <List <CityViewModel> >(await _nomenclatureService.GetCitiesByCountryId(contact.Location.City.Country.Id));
                model.CityId    = contact.Location.City.Id;
                model.CountryId = contact.Location.City.Country.Id;
            }
            model.StatusMessage = StatusMessage;

            return(View(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> CreateDepartment()
        {
            var countries = _mapper.Map <List <CountryViewModel> >(await _nomenclatureService.GetCountries());
            var companies = _mapper.Map <List <CompanyViewModel> >(await _adminService.GetCompanies());

            var model = new CreateDepartmentViewModel
            {
                Cities    = _mapper.Map <List <CityViewModel> >(await _nomenclatureService.GetCitiesByCountryId(countries[0].Id)),
                Countries = countries,
                Companies = companies
            };


            return(View(model));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetCitiesForCountry(string Id)
        {
            var cities = await _nomenclatureService.GetCitiesByCountryId(new Guid(Id));

            var model = _mapper.Map <List <CityViewModel> >(cities);

            return(new JsonResult(model));
        }