protected override void Seed(DZDPortfolioContext context) { var tempProgrammingProject = new ProgrammingProject(); tempProgrammingProject.ProjectTitle = "TestPP"; tempProgrammingProject.UploadDate = DateTime.Now; context.ProgrammingProjects.Add(tempProgrammingProject); var tempDroneProject = new DroneProject(); tempDroneProject.ProjectTitle = "TestDP"; tempDroneProject.UploadDate = DateTime.Now; context.DroneProjects.Add(tempDroneProject); var tempThreeDPrintingProject = new ThreeDPrintingProject(); tempThreeDPrintingProject.ProjectTitle = "Test3D"; tempThreeDPrintingProject.UploadDate = DateTime.Now; context.ThreeDPrintingProjects.Add(tempThreeDPrintingProject); context.SaveChanges(); }
public ActionResult DeleteConfirmed(int id) { DroneProject droneProject = db.DroneProjects.Find(id); db.DroneProjects.Remove(droneProject); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,ProjectTitle,UploadDate")] DroneProject droneProject) { if (ModelState.IsValid) { db.Entry(droneProject).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(droneProject)); }
public ActionResult Create([Bind(Include = "ID,ProjectTitle,UploadDate")] DroneProject droneProject) { if (ModelState.IsValid) { db.DroneProjects.Add(droneProject); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(droneProject)); }
// GET: DroneProjects/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DroneProject droneProject = db.DroneProjects.Find(id); if (droneProject == null) { return(HttpNotFound()); } return(View(droneProject)); }