Ejemplo n.º 1
0
 public ActionResult <IEnumerable <Owner> > Get([FromQuery] Filter filter)
 {
     if (_ownerService.GetOwners().Count == 0)
     {
         return(BadRequest("Owners list is empty."));
     }
     else
     {
         if (filter.CurrentPage < 0 || filter.ItemsPrPage < 0)
         {
             return(BadRequest("Current page and items per page has to be at least 0"));
         }
         if (_ownerService.Count() < filter.ItemsPrPage * (filter.CurrentPage - 1))
         {
             return(BadRequest("Current page is too high"));
         }
         //return _petService.GetPets();
         return(Ok(_ownerService.GetFilteredOwners(filter)));
     }
 }