public ActionResult Edit(Int32?Countryid) { using (CountriesCtl db = new CountriesCtl()){ CountriesClass obj_Countries = db.selectById(Countryid); Session["EditPreviousURL"] = Convert.ToString(ControllerContext.HttpContext.Request.UrlReferrer); return(View(obj_Countries)); } }
public ActionResult SaveRecords(FormCollection model) { if (ModelState.IsValid) { using (CountriesCtl db = new CountriesCtl()){ var CountryidArray = model.GetValues("item.Countryid"); var CountrynameArray = model.GetValues("item.Countryname"); var IsactiveArray = model.GetValues("item.Isactive"); var IsdeletedArray = model.GetValues("item.Isdeleted"); var CreatedonArray = model.GetValues("item.Createdon"); var DeletedonArray = model.GetValues("item.Deletedon"); for (Int32 i = 0; i < CountryidArray.Length; i++) { CountriesClass obj_update = db.selectById(Convert.ToInt32(CountryidArray[i])); if (!string.IsNullOrEmpty(Convert.ToString(CountryidArray))) { obj_update.Countryid = Convert.ToInt32(CountryidArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(CountrynameArray))) { obj_update.Countryname = Convert.ToString(CountrynameArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(IsactiveArray))) { obj_update.Isactive = Convert.ToBoolean(IsactiveArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(IsdeletedArray))) { obj_update.Isdeleted = Convert.ToBoolean(IsdeletedArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(CreatedonArray))) { obj_update.Createdon = Convert.ToDateTime(CreatedonArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(DeletedonArray))) { obj_update.Deletedon = Convert.ToDateTime(DeletedonArray[i]); } db.update(obj_update); } } } return(RedirectToAction("EditTable")); }
public ActionResult Details(Int32?Countryid) { using (CountriesCtl db = new CountriesCtl()){ CountriesClass obj_Countries = db.selectById(Countryid); return(View(obj_Countries)); } }