예제 #1
0
 public IActionResult Post([FromBody] Consumer Consumer)
 {
     if (ModelState.IsValid)
     {
         service.Save(Consumer);
         return(Ok(new CreatedAtRouteResult("create Consumer", new { id = Consumer.Id }, Consumer)));
     }
     return(BadRequest(ModelState));
 }
예제 #2
0
 public IActionResult Post(ConsumerDto consumer)
 {
     try
     {
         return(Ok(_consumerService.Save(consumer)));
     }
     catch (Exception ex)
     {
         _logger.LogError(ex.Message);
         return(BadRequest("Ocorreu uma falha no cadastro de Mesa"));
     }
 }