public ActionResult Index() { using (ProjectRiderDbContext db = new ProjectRiderDbContext()) { List <Project> projects = db.Projects.ToList(); return(View(projects)); } }
public ActionResult Index() { using (var db = new ProjectRiderDbContext()) { var allProject = db.Projects.ToList(); return(this.View(allProject)); } }
public ActionResult Edit(int id) { using (var database = new ProjectRiderDbContext()) { var task = database.Projects.Where(t => t.Id == id).First(); return(View(task)); } }
public ActionResult Index() { using (var context = new ProjectRiderDbContext()) { var project = context.Projects.ToList(); return(View(project)); } }
public ActionResult Edit(int id) { using (var db = new ProjectRiderDbContext()) { Project currentProject = db.Projects.Find(id); return(View(currentProject)); } }
public ActionResult Delete(int id) { using (var db = new ProjectRiderDbContext()) { var project = db.Projects.Find(id); return(View(project)); } }
public ActionResult Delete(int id) { using (var context = new ProjectRiderDbContext()) { Project projectFromDB = context.Projects.Find(id); return(View(projectFromDB)); } }
public ActionResult Edit(int id) { using (var db = new ProjectRiderDbContext()) { Project projectFromDb = db.Projects.Find(id); return(View(projectFromDb)); } }
public ActionResult Index() { using (var database = new ProjectRiderDbContext()) { List <Project> tasks = database.Projects.ToList(); return(View(tasks)); } }
public ActionResult Delete(Project project) { using (ProjectRiderDbContext db = new ProjectRiderDbContext()) { db.Projects.Attach(project); db.Entry(project).State = EntityState.Deleted; db.SaveChanges(); return(RedirectToAction("Index")); } }
public ActionResult Create(Project project) { using (var context = new ProjectRiderDbContext()) { context.Projects.Add(project); context.SaveChanges(); return(this.Redirect("/")); } }
public ActionResult DeleteConfirm(int id, Project reportModel) { using (var context = new ProjectRiderDbContext()) { Project projectFromDB = context.Projects.Find(id); context.Projects.Remove(projectFromDB); context.SaveChanges(); return(Redirect("/")); } }
public ActionResult DeleteConfirm(int id, Project reportModel) { using (var db = new ProjectRiderDbContext()) { var projectFromDb = db.Projects.Find(id); db.Projects.Remove(projectFromDb); db.SaveChanges(); return(Redirect("/")); } }
public ActionResult Delete(int id) { using (var db = new ProjectRiderDbContext()) { var projectToDelete = db.Projects.FirstOrDefault(p => p.Id == id); if (projectToDelete == null) { return(RedirectToAction("Index")); } return(this.View(projectToDelete)); } }
public ActionResult Create(Project project) { if (ModelState.IsValid) { using (var db = new ProjectRiderDbContext()) { db.Projects.Add(project); db.SaveChanges(); return(Redirect("/")); } } return(View()); }
public ActionResult Create(Project project) { if (!ModelState.IsValid) { return(View(project)); } using (ProjectRiderDbContext db = new ProjectRiderDbContext()) { db.Entry(project).State = EntityState.Added; db.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult Delete(int id) { using (var db = new ProjectRiderDbContext()) { var project = db.Projects.Find(id); if (project != null) { return(View(project)); } } return(Redirect("/")); }
public ActionResult Create(Project project) { if (ModelState.IsValid) { using (var database = new ProjectRiderDbContext()) { database.Projects.Add(project); database.SaveChanges(); return(RedirectToAction("Index")); } } return(View()); }
public ActionResult Delete(int id) { using (var context = new ProjectRiderDbContext()) { var project = context.Projects.Find(id); if (project == null) { return(HttpNotFound()); } return(View(project)); } }
public ActionResult Create(Project project) { using (var context = new ProjectRiderDbContext()) { if (this.ModelState.IsValid) { context.Projects.Add(project); context.SaveChanges(); return(Redirect("/")); } return(View(project)); } }
public ActionResult Edit(Project project) { if (!ModelState.IsValid) { return(View(project)); } using (ProjectRiderDbContext db = new ProjectRiderDbContext()) { db.Projects.Attach(project); db.Entry(project).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } }
public ActionResult Delete(int id) { using (var database = new ProjectRiderDbContext()) { var project = database.Projects.Where(f => f.Id == id).First(); if (project == null) { return(HttpNotFound()); } return(View(project)); } }
public ActionResult EditConfirm(int id, Project project) { using (var db = new ProjectRiderDbContext()) { Project currentProject = db.Projects.Find(id); currentProject.Title = project.Title; currentProject.Description = project.Description; currentProject.Budget = project.Budget; db.SaveChanges(); return(Redirect("/")); } }
public ActionResult EditConfirm(int id, Project project) { using (var context = new ProjectRiderDbContext()) { Project taskFromDb = context.Projects.Find(id); taskFromDb.Title = project.Title; taskFromDb.Description = project.Description; taskFromDb.Budget = project.Budget; context.SaveChanges(); return(Redirect("/")); } }
public ActionResult Create(Project project) { //if (!ModelState.IsValid) //{ // return RedirectToAction("Index"); //} using (var db = new ProjectRiderDbContext()) { db.Projects.Add(project); db.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult DeleteConfirm(int id, Project reportModel) { using (var context = new ProjectRiderDbContext()) { var projectFromDb = context.Projects.Find(id); if (projectFromDb == null) { return(HttpNotFound()); } context.Projects.Remove(projectFromDb); context.SaveChanges(); return(Redirect("/")); } }
public ActionResult DeleteConfirm(int id, Project reportModel) { using (var database = new ProjectRiderDbContext()) { var project = database.Projects.Where(f => f.Id == id).First(); if (project == null) { return(HttpNotFound()); } database.Projects.Remove(project); database.SaveChanges(); return(RedirectToAction("Index")); } }
public ActionResult Edit(int id) { using (var db = new ProjectRiderDbContext()) { var project = db.Projects .Where(p => p.Id == id) .First(); if (project == null) { return(HttpNotFound()); } return(View(project)); } }
public ActionResult DeleteConfirm(int id, Project projectModel) { //if (!ModelState.IsValid) //{ // return RedirectToAction("Index"); //} using (var db = new ProjectRiderDbContext()) { var projectToDelete = db.Projects.FirstOrDefault(x => x.Id == id); db.Projects.Remove(projectToDelete); db.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } using (ProjectRiderDbContext db = new ProjectRiderDbContext()) { if (!db.Projects.Any(p => p.Id == id)) { return(View("error")); } Project project = db.Projects.Where(p => p.Id == id).First(); if (project == null) { return(HttpNotFound()); } return(View(project)); } }