Example #1
0
 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);
 }
Example #2
0
        // 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));
        }
Example #3
0
 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);
 }
Example #4
0
 public Model.Customers AddCustomer(Model.Customers customers)
 {
     _context.Customers.Add(
         new Entity.Customer {
         CustomerName   = customers.Name,
         CustomerLocale = customers.Locale,
     }
         );
     _context.SaveChanges();
     return(customers);
 }