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(); }
public ActionResult Index() { var db = new ProjectsContext(); return View(db.Projects.AsEnumerable()); }
public ProjectsRepository(ProjectsContext context) { this.context = context; this.dbSet = context.Set <TEntity>(); }