public ActionResult Edit(Int32 Componentid)
 {
     using (componentCtl db = new componentCtl()){
         componentClass obj_component = db.selectById(Componentid);
         Session["EditPreviousURL"] = Convert.ToString(ControllerContext.HttpContext.Request.UrlReferrer);
         return(View(obj_component));
     }
 }
 public ActionResult SaveRecords(FormCollection model)
 {
     if (ModelState.IsValid)
     {
         using (componentCtl db = new componentCtl()){
             var ComponentidArray   = model.GetValues("item.Componentid");
             var ComponentnameArray = model.GetValues("item.Componentname");
             for (Int32 i = 0; i < ComponentidArray.Length; i++)
             {
                 componentClass obj_update = db.selectById(Convert.ToInt32(ComponentidArray[i]));
                 if (!string.IsNullOrEmpty(Convert.ToString(ComponentidArray)))
                 {
                     obj_update.Componentid = Convert.ToInt32(ComponentidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(ComponentnameArray)))
                 {
                     obj_update.Componentname = Convert.ToString(ComponentnameArray[i]);
                 }
                 db.update(obj_update);
             }
         }
     }
     return(RedirectToAction("EditTable"));
 }
 public ActionResult Details(Int32 Componentid)
 {
     using (componentCtl db = new componentCtl()){ componentClass obj_component = db.selectById(Componentid);
                                                   return(View(obj_component)); }
 }