public ActionResult Edit(buildingdeficiencyrepairClass Obj_buildingdeficiencyrepair) { using (buildingdeficiencyrepairCtl db = new buildingdeficiencyrepairCtl()){ if (ModelState.IsValid) { db.update(Obj_buildingdeficiencyrepair); string sesionval = Convert.ToString(Session["EditPreviousURL"]); if (!string.IsNullOrEmpty(sesionval)) { Session.Remove("EditPreviousURL"); return(Redirect(sesionval)); } else { return(RedirectToAction("Index")); } } return(View(Obj_buildingdeficiencyrepair)); } }
public ActionResult SaveRecords(FormCollection model) { if (ModelState.IsValid) { using (buildingdeficiencyrepairCtl db = new buildingdeficiencyrepairCtl()){ var BuildingdeficiencyrepairidArray = model.GetValues("item.Buildingdeficiencyrepairid"); var BuildingidArray = model.GetValues("item.Buildingid"); var DescriptionArray = model.GetValues("item.Description"); var QuantityArray = model.GetValues("item.Quantity"); var UnitsArray = model.GetValues("item.Units"); var PriorityArray = model.GetValues("item.Priority"); var NoteArray = model.GetValues("item.Note"); var NoteaudioArray = model.GetValues("item.Noteaudio"); var WorkareanoArray = model.GetValues("item.Workareano"); var UseridArray = model.GetValues("item.Userid"); var InserteddatetimeArray = model.GetValues("item.Inserteddatetime"); for (Int32 i = 0; i < BuildingdeficiencyrepairidArray.Length; i++) { buildingdeficiencyrepairClass obj_update = db.selectById(Convert.ToInt32(BuildingdeficiencyrepairidArray[i])); if (!string.IsNullOrEmpty(Convert.ToString(BuildingdeficiencyrepairidArray))) { obj_update.Buildingdeficiencyrepairid = Convert.ToInt32(BuildingdeficiencyrepairidArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(BuildingidArray))) { obj_update.Buildingid = Convert.ToInt32(BuildingidArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(DescriptionArray))) { obj_update.Description = Convert.ToString(DescriptionArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(QuantityArray))) { obj_update.Quantity = Convert.ToInt32(QuantityArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(UnitsArray))) { obj_update.Units = Convert.ToInt32(UnitsArray[i]); } if (!string.IsNullOrEmpty(Convert.ToString(PriorityArray))) { obj_update.Priority = Convert.ToString(PriorityArray[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(WorkareanoArray))) { obj_update.Workareano = Convert.ToInt32(WorkareanoArray[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")); }