Beispiel #1
0
        public async Task <IEnumerable <CityDomainModel> > GetAllAsync()
        {
            var cities = await _citiesRepository.GetAll();

            List <CityDomainModel> cityList = new List <CityDomainModel>();

            foreach (var city in cities)
            {
                CityDomainModel cityModel = new CityDomainModel
                {
                    Id          = city.Id,
                    Name        = city.Name,
                    CinemasList = new List <CinemaDomainModel>()
                };

                foreach (var cinema in city.Cinemas)
                {
                    CinemaDomainModel cinemaModel = new CinemaDomainModel
                    {
                        Id     = cinema.Id,
                        CityId = city.Id,
                        Name   = cinema.Name
                    };

                    cityModel.CinemasList.Add(cinemaModel);
                }

                cityList.Add(cityModel);
            }

            return(cityList);
        }
        public ResponseApi GetCities()
        {
            try
            {
                List <Cities>    lstCities    = _ICitiesRepository.GetAll().ToList();
                List <CitiesDto> lstCitiesDto = _mapper.Map <List <Cities>, List <CitiesDto> >(lstCities);

                return(new ResponseApi
                {
                    ResponseType = "Success",
                    ResponseStatus = true,
                    ResponseObject = lstCitiesDto
                });
            }
            catch (Exception Ex)
            {
                while (Ex.InnerException != null)
                {
                    Ex = Ex.InnerException;
                }
                return(new ResponseApi {
                    ResponseStatus = false,
                    ResponseMessage = Ex.Message,
                    ResponseType = "Error"
                });
            }
        }
Beispiel #3
0
        public IActionResult Index()
        {
            var cities = repository.GetAll();
            var vms    = new List <CityViewModel>();

            foreach (var city in cities)
            {
                vms.Add(new CityViewModel {
                    Name = city.Name, Description = city.Description
                });
            }
            return(View(vms));
        }
Beispiel #4
0
 public IList <Cities> GetAllCities()
 {
     return(_citiesRepository.GetAll());
 }
Beispiel #5
0
 public IEnumerable <Cities> GetSuggestions()
 {
     return(CitiesRepository.GetAll());
 }
Beispiel #6
0
 public List <CityModel> GetAllCities()
 {
     return(citiesRepository.GetAll());
 }
Beispiel #7
0
 public IEnumerable <TblCities> Details()
 {
     return(cityRepo.GetAll());
 }
        public ActionResult GetAll()
        {
            List <City> cities = _citiesRepository.GetAll();

            return(Ok(cities));
        }
        public IQueryable <City> GetAllCities()
        {
            var rez = _citiesRepository.GetAll();

            return(rez);
        }