Example #1
0
        /*Admin-List Search*/

        /*City-List Search*/

        public JsonResult SearchCityList(string searchBy, string searchValue, int?page, int?rows)
        {
            var         pageNo    = page ?? 1;
            var         numOfRows = rows ?? 5;
            List <City> cityList;

            switch (searchBy)
            {
            case "id":
                //search by id
                cityList = cityRepository.GetAll().Where(c => c.Id.ToString().ToLower().Contains(searchValue.ToLower()) || searchValue == null).ToList();
                break;

            case "name":
                //search by name
                cityList = cityRepository.GetAll().Where(c => c.Name.ToLower().Contains(searchValue.ToLower()) || searchValue == null).ToList();
                break;

            default:
                //by default, search by name
                cityList = cityRepository.GetAll().Where(c => c.Name.ToLower().Contains(searchValue.ToLower()) || searchValue == null).ToList();
                break;
            }
            return(Json(cityList, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Insert()
        {
            var cities    = cityRepository.GetAll().OrderBy(c => c.Name);
            var viewModel = new ClientFormViewModel
            {
                Cities = cities
            };

            return(View(viewModel));
        }
Example #3
0
        public ActionResult Insert()
        {
            var cities    = cityRepository.GetAll().OrderBy(c => c.Name);
            var services  = serviceRepository.GetAll().OrderBy(s => s.ServiceName);
            var viewModel = new LabourFormViewModel
            {
                Cities   = cities,
                Services = services
            };

            return(View(viewModel));
        }
Example #4
0
        public ActionResult Add(UserType userType)
        {
            var user = new User {
                DateOfBirth = DateTime.Today.AddYears(-18), JoiningDateTime = DateTime.Now, UserType = userType
            };
            var cities    = _cityRepo.GetAll().OrderBy(c => c.Name);
            var viewModel = new UserFormViewModel
            {
                User   = user,
                Cities = cities,
            };

            return(View(viewModel));
        }
Example #5
0
        public IActionResult Create()
        {
            var cities = _cityService.GetAll();

            var allCities = cities.Select(c => new City
            {
                Id   = c.Id,
                Name = c.Name
            });

            var model = new CarrierInputModel
            {
                Cities = allCities
            };

            return(View(model));
        }
        public ActionResult CityList(int?page, int?rows)
        {
            var pageNo    = page ?? 1;
            var numOfRows = rows ?? 5;

            var city = cityRepository.GetAll().OrderBy(c => c.Name).ToList().ToPagedList(pageNo, numOfRows);

            return(View(city));
        }
        public async Task <ActionResult <City> > GetAllCities()
        {
            var cities = _cityService.GetAll();

            if (cities == null)
            {
                return(BadRequest("Nije moguce ucitati gradove"));
            }

            return(Ok(cities));
        }
Example #8
0
        public IActionResult GetAll()
        {
            try
            {
                var result = _city.GetAll();

                return(Ok(result));
            }
            catch (Exception e)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, e));
            }
        }
        public IActionResult Create()
        {
            var cities          = _cityService.GetAll();
            var carriers        = _carrierService.GetAll();
            var paymentCategory = _paymentCategoryService.GetAll();
            var vehicles        = _vehicleService.GetAll();

            var model = new DepartureInputModel
            {
                Cities            = cities,
                Carriers          = carriers,
                PaymentCategories = paymentCategory,
                Vehicles          = vehicles
            };

            return(View(model));
        }
Example #10
0
        public override async Task <CitiesResponse> GetCities(EmptyRequest request, ServerCallContext context)
        {
            var cities = _cityService.GetAll();

            if (cities == null)
            {
                _logger.LogError("cities doesn't found");
                return(null);
            }

            _logger.LogInformation("cities found");
            var convertedCities = cities.Select(x => _mapper.Map <CityResponse>(x));

            return(new CitiesResponse
            {
                Cities = { convertedCities }
            });
        }
Example #11
0
        public IActionResult Index()
        {
            var citys = _cityService.GetAll();

            var cityListing = citys.Select(c => new CityDetailModel
            {
                Id          = c.Id,
                Name        = c.Name,
                ImageUrl    = c.ImageUrl,
                ZipCode     = c.ZipCode,
                Carriers    = _carrierService.GetByCity(c),
                BusStations = _busStationService.GetByCity(c.Id)
            });

            var model = new CityIndexModel
            {
                Cities = cityListing
            };

            return(View(model));
        }
        public IActionResult GetAllCities()
        {
            var result = _getCities.GetAll();

            return(Ok(result));
        }
Example #13
0
        public async Task <ActionResult <IEnumerable <City> > > GetAllCity()
        {
            var cities = await repository.GetAll();

            return(StatusCode(StatusCodes.Status200OK, cities));
        }
 public IEnumerable <CityDTO> GetCity()
 {
     return(CityRep.GetAll());
 }
        // GET: City
        public ActionResult Index()
        {
            var list = cityrepository.GetAll().ToList();

            return(View(list));
        }
 public ActionResult Create()
 {
     ViewBag.StateId = new SelectList(staterepository.GetAll(), "StateId", "StateName");
     ViewBag.CityId  = new SelectList(cityrepository.GetAll(), "CityId", "CityName");
     return(View());
 }