public ActionResult Create(workorderfollowupClass Obj_workorderfollowup, string command) { using (workorderfollowupCtl db = new workorderfollowupCtl()){ if (ModelState.IsValid) { db.insert(Obj_workorderfollowup); if (command.ToLower().Trim() == "save") { string sesionval = Convert.ToString(Session["CreatePreviousURL"]); if (!string.IsNullOrEmpty(sesionval)) { Session.Remove("CreatePreviousURL"); return(Redirect(sesionval)); } else { return(RedirectToAction("Index")); } } else { ModelState.Clear(); return(View()); } } return(View(Obj_workorderfollowup)); } }
public ActionResult SaveRecords(FormCollection model) { if (ModelState.IsValid) { using (workorderfollowupCtl db = new workorderfollowupCtl()){ var WorkorderfollowupidArray = model.GetValues("item.Workorderfollowupid"); var WorkorderidArray = model.GetValues("item.Workorderid"); var DatecompletedArray = model.GetValues("item.Datecompleted"); var LabourArray = model.GetValues("item.Labour"); var PartssuppiesArray = model.GetValues("item.Partssuppies"); var NoteArray = model.GetValues("item.Note"); var NoteaudioArray = model.GetValues("item.Noteaudio"); var UseridArray = model.GetValues("item.Userid"); var InserteddatetimeArray = model.GetValues("item.Inserteddatetime"); for (Int32 i = 0; i < WorkorderfollowupidArray.Length; i++) { workorderfollowupClass obj_update = db.selectById(Convert.ToInt32(WorkorderfollowupidArray[i])); if (!string.IsNullOrEmpty(Convert.ToString(WorkorderfollowupidArray))) { obj_update.Workorderfollowupid = Convert.ToInt32(WorkorderfollowupidArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(WorkorderidArray))) { obj_update.Workorderid = Convert.ToInt32(WorkorderidArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(DatecompletedArray))) { obj_update.Datecompleted = Convert.ToDateTime(DatecompletedArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(LabourArray))) { obj_update.Labour = Convert.ToInt32(LabourArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(PartssuppiesArray))) { obj_update.Partssuppies = Convert.ToString(PartssuppiesArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(NoteArray))) { obj_update.Note = Convert.ToString(NoteArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(NoteaudioArray))) { obj_update.Noteaudio = Convert.To(NoteaudioArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(UseridArray))) { obj_update.Userid = Convert.ToInt32(UseridArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(InserteddatetimeArray))) { obj_update.Inserteddatetime = Convert.ToDateTime(InserteddatetimeArray[i]); } db.update(obj_update); } } } return(RedirectToAction("EditTable")); }
public ActionResult Edit(Int32 Workorderfollowupid) { using (workorderfollowupCtl db = new workorderfollowupCtl()){ workorderfollowupClass obj_workorderfollowup = db.selectById(Workorderfollowupid); Session["EditPreviousURL"] = Convert.ToString(ControllerContext.HttpContext.Request.UrlReferrer); return(View(obj_workorderfollowup)); } }
public ActionResult Edit(workorderfollowupClass Obj_workorderfollowup) { using (workorderfollowupCtl db = new workorderfollowupCtl()){ if (ModelState.IsValid) { db.update(Obj_workorderfollowup); string sesionval = Convert.ToString(Session["EditPreviousURL"]); if (!string.IsNullOrEmpty(sesionval)) { Session.Remove("EditPreviousURL"); return(Redirect(sesionval)); } else { return(RedirectToAction("Index")); } } return(View(Obj_workorderfollowup)); } }
public ActionResult Details(Int32 Workorderfollowupid) { using (workorderfollowupCtl db = new workorderfollowupCtl()){ workorderfollowupClass obj_workorderfollowup = db.selectById(Workorderfollowupid); return(View(obj_workorderfollowup)); } }