//get all cats! /// <summary> /// Returns all cats from database /// </summary> /// <returns></returns> public IHttpActionResult GetAll() { CatServices catService = CreateCatServices(); var cat = catService.GetAllCats(); return(Ok(cat)); }
//cat service private CatServices CreateCatServices() { var userId = Guid.Parse(User.Identity.GetUserId()); //new ShelterServices(userId); var catServices = new CatServices(userId); return(catServices); }
//get cats by breed //[Route("get-cats-by-breed")] /// <summary> /// Returns cats by specific breed /// </summary> /// <param name="breed"></param> /// <returns></returns> public IHttpActionResult GetBreed(string breed) { CatServices catServices = CreateCatServices(); var cat = catServices.GetCatsByBreed(breed); if (cat is null) { return(Ok($"Sorry! Looks like there are currently no {breed} cats in our database. 乁( ⁰͡ Ĺ̯ ⁰͡ ) ㄏ")); } return(Ok(cat)); }
//get cat by id public IHttpActionResult GetById(int id) { CatServices catService = CreateCatServices(); var cat = catService.GetCatById(id); if (cat is null) { return(Ok($"Sorry! Looks like there are currently no cats with the provided ID in our database. ᕙ(⇀‸↼‶)ᕗ")); } return(Ok(cat)); }