Exemplo n.º 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();
        }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            var db = new ProjectsContext();

               return View(db.Projects.AsEnumerable());
        }
Exemplo n.º 3
0
 public ProjectsRepository(ProjectsContext context)
 {
     this.context = context;
     this.dbSet   = context.Set <TEntity>();
 }