Exemplo n.º 1
0
        public IActionResult Index(int page, int pageSize, string search)
        {
            int countTotalLocations = _locationServices.CountLocations();
            PaginationViewModel <LocationViewModel> model = new PaginationViewModel <LocationViewModel>();

            if (page == 0)
            {
                page = 1;
            }
            if (pageSize == 0)
            {
                pageSize = model.PageSizeItem.Min();
            }
            model.Pager = new Pager(countTotalLocations, page, pageSize);
            if (String.IsNullOrEmpty(search))
            {
                model.Items = _locationServices.GetAllLocations(page, pageSize).ToList();
            }
            else
            {
                model.Items = _locationServices.GetAllLocations(page, pageSize, search).ToList();
            }
            ViewBag.Search = search;
            return(View(model));
        }
Exemplo n.º 2
0
 // GET: Journeys/Create
 public ActionResult Create()
 {
     ViewBag.DestinationLocationCode = new SelectList(locationService.GetAllLocations(), "LocationCode", "LocationName");
     ViewBag.OperatingCompanyId      = new SelectList(operatingCompanyService.GetAllOperatingCompanies(), "OperatingCompanyId", "OperatingCompanyName");
     ViewBag.OriginLocationCode      = new SelectList(locationService.GetAllLocations(), "LocationCode", "LocationName");
     return(View());
 }
 public IActionResult GetAllLocations()
 {
     try
     {
         return(Ok(locationServices.GetAllLocations()));
     }
     catch (Exception)
     {
         return(StatusCode(500));
     }
 }
Exemplo n.º 4
0
 // GET: Locations
 public ActionResult Index()
 {
     return(View(service.GetAllLocations()));
 }