public ActionResult DeleteConfirmed(int id) { table_house_senior_details table_house_senior_details = db.table_house_senior_details.Find(id); db.table_house_senior_details.Remove(table_house_senior_details); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "senior_id,Home_no,Education,Occupation,Contact_no,DOB,BirthPlace,CitizenShip_no,CitizenshipIssue_district,citizenissue_date,Name")] table_house_senior_details table_house_senior_details) { if (ModelState.IsValid) { db.Entry(table_house_senior_details).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(table_house_senior_details)); }
// GET: seniordetails/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } table_house_senior_details table_house_senior_details = db.table_house_senior_details.Find(id); if (table_house_senior_details == null) { return(HttpNotFound()); } return(View(table_house_senior_details)); }
public ActionResult Create([Bind(Include = "senior_id,Home_no,Education,Occupation,Contact_no,DOB,BirthPlace,CitizenShip_no,CitizenshipIssue_district,citizenissue_date,Name")] table_house_senior_details table_house_senior_details) { if (ModelState.IsValid) { if (!db.table_house_senior_details.Any(u => u.Home_no == table_house_senior_details.Home_no)) { db.table_house_senior_details.Add(table_house_senior_details); db.SaveChanges(); var result = db.pdffiles // this explicit query is here .Where(stats => stats.senior_status == false) .Take(1); foreach (var item in result) { ViewBag.file = item.File; pdffile pdff = new pdffile(); using (var con = new woda_testEntities()) { pdff = con.pdffiles.First(x => x.File == item.File); pdff.senior_status = true; con.pdffiles.Attach(pdff); var entry = con.Entry(pdff); entry.Property(e => e.senior_status).IsModified = true; con.SaveChanges(); } } return(RedirectToAction("Index")); } else { ViewBag.error = "This Home Number already added"; } } return(View(table_house_senior_details)); }