public ActionResult Details(Int32?Contactusdataid) { using (ContactUsDataCtl db = new ContactUsDataCtl()) { ContactUsDataClass obj_ContactUsData = db.selectById(Contactusdataid); return(View(obj_ContactUsData)); } }
public ActionResult Edit(Int32?Contactusdataid) { using (ContactUsDataCtl db = new ContactUsDataCtl()) { ContactUsDataClass obj_ContactUsData = db.selectById(Contactusdataid); Session["EditPreviousURL"] = Convert.ToString(ControllerContext.HttpContext.Request.UrlReferrer); return(View(obj_ContactUsData)); } }
public ActionResult SaveRecords(FormCollection model) { if (ModelState.IsValid) { using (ContactUsDataCtl db = new ContactUsDataCtl()) { var ContactusdataidArray = model.GetValues("item.Contactusdataid"); var NameArray = model.GetValues("item.Name"); var EmailArray = model.GetValues("item.Email"); var MessagesubjectArray = model.GetValues("item.Messagesubject"); var DetailedmessageArray = model.GetValues("item.Detailedmessage"); var AddeddatetimeArray = model.GetValues("item.Addeddatetime"); var AddedipArray = model.GetValues("item.Addedip"); for (Int32 i = 0; i < ContactusdataidArray.Length; i++) { ContactUsDataClass obj_update = db.selectById(Convert.ToInt32(ContactusdataidArray[i])); if (!string.IsNullOrEmpty(Convert.ToString(ContactusdataidArray))) { obj_update.Contactusdataid = Convert.ToInt32(ContactusdataidArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(NameArray))) { obj_update.Name = Convert.ToString(NameArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(EmailArray))) { obj_update.Email = Convert.ToString(EmailArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(MessagesubjectArray))) { obj_update.Messagesubject = Convert.ToString(MessagesubjectArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(DetailedmessageArray))) { obj_update.Detailedmessage = Convert.ToString(DetailedmessageArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(AddeddatetimeArray))) { obj_update.Addeddatetime = Convert.ToDateTime(AddeddatetimeArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(AddedipArray))) { obj_update.Addedip = Convert.ToString(AddedipArray[i]); } db.update(obj_update); } } } return(RedirectToAction("EditTable")); }