public IActionResult Post([FromBody] RestaurantePostDto dto) { try { return(StatusCode(StatusCodes.Status201Created, JsonConvert.SerializeObject(_business.Insert(dto).Id))); } catch (DomainException e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
public Restaurante Insert(RestaurantePostDto dto) { var db = new Restaurante { Nome = dto.Nome.Trim() }; _uow.RestauranteRepository.Add(db); _uow.SaveChanges(); return(db); }