Example #1
0
 public List <Entity.Customer> Search(string searchText)
 {
     if (!string.IsNullOrEmpty(searchText))
     {
         return(_context.Set <Entity.Customer>().Where(BuildLikeExpression(searchText)).ToList());
     }
     else
     {
         return(_context.Customers.ToList());
     }
 }
Example #2
0
        // GET: Customers/DeleteALl/5
        public ActionResult DeleteAll(string confirmButton)
        {
            using (var context = new CustomerDBContext())
            {
                var itemsToDelete = context.Set <Customer>();
                context.Customers.RemoveRange(itemsToDelete);
                context.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }