Пример #1
0
 public ActionResult Edit(jobtypeClass Obj_jobtype)
 {
     using (jobtypeCtl db = new jobtypeCtl()){
         if (ModelState.IsValid)
         {
             db.update(Obj_jobtype);
             string sesionval = Convert.ToString(Session["EditPreviousURL"]);
             if (!string.IsNullOrEmpty(sesionval))
             {
                 Session.Remove("EditPreviousURL");
                 return(Redirect(sesionval));
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
         }
         return(View(Obj_jobtype));
     }
 }
Пример #2
0
 public ActionResult SaveRecords(FormCollection model)
 {
     if (ModelState.IsValid)
     {
         using (jobtypeCtl db = new jobtypeCtl()){
             var JobtypeidArray = model.GetValues("item.Jobtypeid");
             var JobtypeArray   = model.GetValues("item.Jobtype");
             for (Int32 i = 0; i < JobtypeidArray.Length; i++)
             {
                 jobtypeClass obj_update = db.selectById(Convert.ToInt32(JobtypeidArray[i]));
                 if (!string.IsNullOrEmpty(Convert.ToString(JobtypeidArray)))
                 {
                     obj_update.Jobtypeid = Convert.ToInt32(JobtypeidArray[i]);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(JobtypeArray)))
                 {
                     obj_update.Jobtype = Convert.ToString(JobtypeArray[i]);
                 }
                 db.update(obj_update);
             }
         }
     }
     return(RedirectToAction("EditTable"));
 }