public bool GetCustomer2(Model.Customers customers) { Entity.Customer found = _context.Customers.FirstOrDefault(custo => custo.CustomerName == customers.Name && custo.CustomerLocale == customers.Locale); if (found == null) { return(false); } return(true); }
// public List<Model.Customers> GetAllCustomers() // { // return _context.Customers // .Select( // customers => new Model.Customers(customers.Name, customer.Locale, customer.Quantity) // ).ToList(); // } public Model.Customers GetCustomer(Model.Customers customers) { Entity.Customer found = _context.Customers.FirstOrDefault(custo => custo.CustomerName == customers.Name && custo.CustomerLocale == customers.Locale); if (found == null) { return(null); } return(new Model.Customers(found.CustomerName, found.CustomerLocale)); }
public int GetCustomer1(Model.Customers customers) { Entity.Customer found = _context.Customers.FirstOrDefault(custo => custo.CustomerName == customers.Name && custo.CustomerLocale == customers.Locale); if (found == null) { Console.WriteLine("Could not find customer"); } ; return(found.CustomerId); }
public Model.Customers AddCustomer(Model.Customers customers) { _context.Customers.Add( new Entity.Customer { CustomerName = customers.Name, CustomerLocale = customers.Locale, } ); _context.SaveChanges(); return(customers); }