public ActionResult Delete(Int32 id) { Model_State obj = db.tbl_states.Where(x => x.state_id == id).Select(x => new Model_State() { state_id = x.state_id, country_id = x.country_id, state_name = x.state_name }).SingleOrDefault(); return(View(obj)); }
public ActionResult Edit(Model_State obj) { tbl_state tb = db.tbl_states.Where(x => x.state_id == obj.state_id).Single <tbl_state>(); tb.state_id = obj.state_id; tb.country_id = obj.country_id; tb.state_name = obj.state_name; db.SubmitChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(Model_State obj) { tbl_state tb = new tbl_state(); tb.country_id = obj.country_id; tb.state_name = obj.state_name; db.tbl_states.InsertOnSubmit(tb); db.SubmitChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(int id) { Model_State obj = db.tbl_states.Where(x => x.state_id == id).Select(x => new Model_State() { state_id = x.state_id, country_id = x.country_id, state_name = x.state_name }).SingleOrDefault(); ViewBag.countryid = new SelectList(db.tbl_countries.ToList(), "country_id", "country_name", obj.country_id); return(View(obj)); }