Пример #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());
        }
Пример #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
                       ));
        }
Пример #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
        }
Пример #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());
        }
Пример #5
0
        public Customer RegisterCustomer(AddCustomerInputModel model)
        {
            Customer customer = new Customer(model.FullName, model.Document, model.BirthDate);

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

            return(customer);
        }
Пример #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));
        }
Пример #7
0
 public IActionResult Post([FromBody] AddCustomerInputModel model)
 {
     return(Ok());
 }
        public IActionResult Post([FromBody] AddCustomerInputModel model)
        {
            _customerServices.RegisterCustomer(model);

            return(NoContent());
        }