public ActionResult DeleteConfirmed(int id) { table_home_facility table_home_facility = db.table_home_facility.Find(id); db.table_home_facility.Remove(table_home_facility); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "F_id,House_type,House_area,House_total_area,roof_type,on_rent,cooking_type,entertainment,annual_income,sampannata_sthar,drinking_water,drinking_water_TYPE,fohormaila_bewasthapan,irrigation,irrigation_type,sadak_pugeko,sadak_type,bhukampa_jokhim,house_used_for,Ghar_naksha,storey,electricity,electricity_type,senior_id")] table_home_facility table_home_facility) { if (ModelState.IsValid) { db.Entry(table_home_facility).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.senior_id = new SelectList(db.table_house_senior_details, "senior_id", "Home_no", table_home_facility.senior_id); return(View(table_home_facility)); }
// GET: homefacility/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } table_home_facility table_home_facility = db.table_home_facility.Find(id); if (table_home_facility == null) { return(HttpNotFound()); } return(View(table_home_facility)); }
// GET: homefacility/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } table_home_facility table_home_facility = db.table_home_facility.Find(id); if (table_home_facility == null) { return(HttpNotFound()); } ViewBag.senior_id = new SelectList(db.table_house_senior_details, "senior_id", "Home_no", table_home_facility.senior_id); return(View(table_home_facility)); }
public ActionResult Create([Bind(Include = "F_id,House_type,House_area,House_total_area,roof_type,on_rent,cooking_type,entertainment,annual_income,sampannata_sthar,drinking_water,drinking_water_TYPE,fohormaila_bewasthapan,irrigation,irrigation_type,sadak_pugeko,sadak_type,bhukampa_jokhim,house_used_for,Ghar_naksha,storey,electricity,electricity_type,senior_id")] table_home_facility table_home_facility) { if (ModelState.IsValid) { if (!db.table_home_facility.Any(u => u.senior_id == table_home_facility.senior_id)) { db.table_home_facility.Add(table_home_facility); db.SaveChanges(); //update status value var result = db.pdffiles // this explicit query is here .Where(stats => stats.home_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.home_status = true; con.pdffiles.Attach(pdff); var entry = con.Entry(pdff); entry.Property(e => e.home_status).IsModified = true; con.SaveChanges(); } } return(RedirectToAction("Index")); } else { ViewBag.error = "This Home Number already added"; } } ViewBag.senior_id = new SelectList(db.table_house_senior_details, "senior_id", "Home_no", table_home_facility.senior_id); return(View(table_home_facility)); }