public HttpResponseMessage GetUserDogs(int userid) { Userservice userservice = new Userservice(); List <DogDetailsView> list = userservice.GetUserDogs(userid); if (list.Count == 0) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } else { return(Request.CreateResponse(HttpStatusCode.OK, list)); } }