Exemplo n.º 1
0
        public async Task <CountryDetailsModel> GetCountry(int countryId)
        {
            CountryDetailsDto countryDetailsDto = await _countryService.GetCountryAsync(countryId);

            CountryDetailsModel countryDetailsModel = _mapper.Map <CountryDetailsModel>(countryDetailsDto);

            return(countryDetailsModel);
        }
Exemplo n.º 2
0
        public ActionResult EditCountry(CountryDetailsModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var countryDto = Mapper.Map <CountryDto>(model);

            _countryService.EditCountry(countryDto);

            return(Redirect("CountryList"));
        }
Exemplo n.º 3
0
        public ActionResult Details(int id)
        {
            var country = _context.Countries.FirstOrDefault(c => c.Id == id);

            var model = new CountryDetailsModel
            {
                Id         = country.Id,
                Name       = country.Name,
                DateCreate = country.DateCreate,
                Priority   = country.Priority
            };

            return(View(model));
        }