Exemplo n.º 1
0
        public IActionResult Post([FromBody] AddCustomerInputModel model)
        {
            var customer = new Customer(4, model.FullName, model.Document, model.BirthDate);

            _dbContext.Customers.Add(customer);
            return(NoContent());
        }
Exemplo n.º 2
0
        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
                       ));
        }
Exemplo n.º 3
0
        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
        }
Exemplo n.º 4
0
        public IActionResult Post([FromBody] AddCustomerInputModel model)
        {
            var cliente = new Cliente(model.Nome, model.Documento, model.Aniversario);

            _dbContext.Clientes.Add(cliente);
            _dbContext.SaveChanges();

            return(NoContent());
        }
Exemplo n.º 5
0
        public Customer RegisterCustomer(AddCustomerInputModel model)
        {
            Customer customer = new Customer(model.FullName, model.Document, model.BirthDate);

            _dbContext.Add(customer);
            _dbContext.SaveChanges();

            return(customer);
        }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
0
 public IActionResult Post([FromBody] AddCustomerInputModel model)
 {
     return(Ok());
 }
        public IActionResult Post([FromBody] AddCustomerInputModel model)
        {
            _customerServices.RegisterCustomer(model);

            return(NoContent());
        }