Exemple #1
0
        private CustomersModel GetNewCustomer(CustomersForInsertModel newCustomer)
        {
            CustomersModel customer = new CustomersModel();

            customer.Age           = newCustomer.Age;
            customer.VisitDateTime = DateTime.Now;
            customer.WasSatisfied  = newCustomer.WasSatisfied;
            customer.Sex           = newCustomer.Sex;
            return(customer);
        }
Exemple #2
0
        public async Task <ActionResult <CustomersForInsertModel> > InputCustomerAsync(CustomersForInsertModel customer)
        {
            try
            {
                CustomersModel newCustomer = GetNewCustomer(customer);
                _context.Add(newCustomer);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(NoContent());
        }