public IEnumerable <Location> Get([FromBody] GridModel model)
        {
            var locations = new List <Location>();

            if (model.SearchingColumns.Count > 0 && !string.IsNullOrEmpty(model.SearchingText))
            {
                locations = LocationsService.GetLocations()
                            .Where(location =>
                                   location.Description.ToLower().Contains(model.SearchingText.ToLower()) ||
                                   location.Name.ToLower().Contains(model.SearchingText.ToLower()))
                            .ToList();
            }
            else if (model.ParentId == null)
            {
                locations = LocationsService.GetLocations()
                            .Where(location => location.ParentId == model.ParentId)
                            .ToList();
            }
            else
            {
                locations = LocationsService.GetLocations();
            }

            return(locations);
        }
        public IEnumerable <Location> GetTest([FromBody] GridModel model)
        {
            var locations = new List <Location>();

            if (model.ParentId == null)
            {
                locations = LocationsService.GetLocations()
                            .Where(location => location.ParentId == model.ParentId)
                            .ToList();
            }
            else
            {
                locations = LocationsService.GetLocations();
            }

            return(locations);
        }
Exemple #3
0
 public ActionResult <string> GetLocations()
 {
     return(_locationsService.GetLocations());
 }