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); }
public async Task <ActionResult <CustomersForInsertModel> > InputCustomerAsync(CustomersForInsertModel customer) { try { CustomersModel newCustomer = GetNewCustomer(customer); _context.Add(newCustomer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(NoContent()); }