public IActionResult Post([FromBody] AddCustomerInputModel model) { var customer = new Customer(4, model.FullName, model.Document, model.BirthDate); _dbContext.Customers.Add(customer); return(NoContent()); }
public IActionResult Post([FromBody] AddCustomerInputModel model) { if (model.FullName == null) { return(BadRequest("Campo Nome Completo é obrigatório")); } var customer = new Customer( model.FullName, model.Document, model.BirthDate ); _dbcontext.Customers.Add(customer); _dbcontext.SaveChanges(); return(CreatedAtAction( nameof(GetById), new { id = customer.Id }, model )); }
public IActionResult Post([FromBody] AddCustomerInputModel model) { var customer = new Customer(model.FullName, model.Document, model.BirthDate); _dbContext.Customers.Add(customer); _dbContext.SaveChanges(); return(Ok()); //trocar para noContent }
public IActionResult Post([FromBody] AddCustomerInputModel model) { var cliente = new Cliente(model.Nome, model.Documento, model.Aniversario); _dbContext.Clientes.Add(cliente); _dbContext.SaveChanges(); return(NoContent()); }
public Customer RegisterCustomer(AddCustomerInputModel model) { Customer customer = new Customer(model.FullName, model.Document, model.BirthDate); _dbContext.Add(customer); _dbContext.SaveChanges(); return(customer); }
public IActionResult Post([FromBody] AddCustomerInputModel customerInputModel) { var customer = new Customer( customerInputModel.FullName, customerInputModel.Document, customerInputModel.BirthDate ); Context.Customers.Add(customer); Context.SaveChanges(); return(Ok(customer)); }
public IActionResult Post([FromBody] AddCustomerInputModel model) { return(Ok()); }
public IActionResult Post([FromBody] AddCustomerInputModel model) { _customerServices.RegisterCustomer(model); return(NoContent()); }