Beispiel #1
0
 public ActionResult Edit(Int32?Stateid)
 {
     using (StatesCtl db = new StatesCtl()){
         StatesClass obj_States = db.selectById(Stateid);
         Session["EditPreviousURL"] = Convert.ToString(ControllerContext.HttpContext.Request.UrlReferrer);
         return(View(obj_States));
     }
 }
Beispiel #2
0
 public ActionResult SaveRecords(FormCollection model)
 {
     if (ModelState.IsValid)
     {
         using (StatesCtl db = new StatesCtl()){
             var StateidArray   = model.GetValues("item.Stateid");
             var StatenameArray = model.GetValues("item.Statename");
             var CountryidArray = model.GetValues("item.Countryid");
             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 < StateidArray.Length; i++)
             {
                 StatesClass obj_update = db.selectById(Convert.ToInt32(StateidArray[i]));
                 if (!string.IsNullOrEmpty(Convert.ToString(StateidArray)))
                 {
                     obj_update.Stateid = Convert.ToInt32(StateidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(StatenameArray)))
                 {
                     obj_update.Statename = Convert.ToString(StatenameArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(CountryidArray)))
                 {
                     obj_update.Countryid = Convert.ToInt32(CountryidArray[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"));
 }
Beispiel #3
0
 public ActionResult Details(Int32?Stateid)
 {
     using (StatesCtl db = new StatesCtl()){ StatesClass obj_States = db.selectById(Stateid);
                                             return(View(obj_States)); }
 }