public ActionResult DeleteConfirmed(int id) { section1Model section1Model = db.section1Model.Find(id); db.section1Model.Remove(section1Model); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(section1Model section1Model) { if (ModelState.IsValid) { db.Entry(section1Model).State = EntityState.Modified; db.SaveChanges(); return(View(section1Model)); } return(View(section1Model)); }
// GET: section1Model/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } section1Model section1Model = db.section1Model.Find(id); if (section1Model == null) { return(HttpNotFound()); } return(View(section1Model)); }
public ActionResult Create(section1Model section1Model) { if (ModelState.IsValid) { db.section1Model.Add(section1Model); db.SaveChanges(); //var email = new NewCommentEmail //{ // To = "*****@*****.**", // UserName = section1Model.ProjectName, // Comment = section1Model.ToString() //}; //email.Send(); return(RedirectToAction("Edit", "section1Model", new { id = section1Model.id })); } return(View(section1Model)); }