public IHttpActionResult Feed(Animal animal) { if (!ModelState.IsValid) { return(BadRequest()); } _animalService.Feed(animal); var fedAnimal = _animalService.GetAnimal(animal.Id); return(Ok(fedAnimal)); }
public ActionResult Feed(int id, [FromBody] string food) { try { _service.Feed(id, food); return(Ok()); } catch (ValidationException ex) { return(BadRequest(ex.Message)); } catch (NullDataException ex) { return(NotFound(ex.Message)); } }
public async Task Feed([FromBody] FeedAnimalDto feedAnimalDto) { await _animalService.Feed(feedAnimalDto); }
private void btnFeed_Click(object sender, EventArgs e) { _service.Feed(); RefreshGrid(); }