Пример #1
0
        public ActionResult RemoveAll()
        {
            int i = 0;
            using(var db = new ProjectsContext())
            {
                foreach(var item in db.Projects.ToList())
                {
                    db.Projects.Remove(item);
                    i++;
                }
                db.SaveChanges();
            }

            ViewBag.Message = i + " projects are removed.";
            return View();
        }
Пример #2
0
        public ActionResult Index()
        {
            var db = new ProjectsContext();

               return View(db.Projects.AsEnumerable());
        }
Пример #3
0
 public ProjectsRepository(ProjectsContext context)
 {
     this.context = context;
     this.dbSet   = context.Set <TEntity>();
 }