Exemplo n.º 1
0
        public IHttpActionResult Feed(Animal animal)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            _animalService.Feed(animal);
            var fedAnimal = _animalService.GetAnimal(animal.Id);

            return(Ok(fedAnimal));
        }
Exemplo n.º 2
0
 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));
     }
 }
Exemplo n.º 3
0
 public async Task Feed([FromBody] FeedAnimalDto feedAnimalDto)
 {
     await _animalService.Feed(feedAnimalDto);
 }
Exemplo n.º 4
0
 private void btnFeed_Click(object sender, EventArgs e)
 {
     _service.Feed();
     RefreshGrid();
 }