예제 #1
0
        public async Task <IActionResult> PutCustomers(int id, DataModels.Customers customers)
        {
            if (id != customers.CustomerId)
            {
                return(BadRequest());
            }

            try
            {
                var mapaux = _mapper.Map <datamodels.Customers, data.Customers>(customers);

                new BS.Customers(_context).Update(mapaux);
            }
            catch (Exception ee)
            {
                if (!CustomersExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult <DataModels.Customers> > PostCustomers(DataModels.Customers customers)
        {
            var mapaux = _mapper.Map <datamodels.Customers, data.Customers>(customers);

            new BS.Customers(_context).Insert(mapaux);


            return(CreatedAtAction("GetCustomers", new { id = customers.CustomerId }, customers));
        }