public ActionResult Edit(int?id) { OUCommon obj = OUCommonService.GetEdit((int)id); DDHelper(obj); return(PartialView(obj)); }
public ActionResult Create() { OUCommon obj = new OUCommon(); DDHelper(obj); return(View()); }
private void DDHelper(OUCommon obj) { //ViewBag.OTPolicyID = new SelectList(DDService.GetOTPolicy().ToList().OrderBy(aa => aa.OTPolicyName).ToList(), "POTPolicyID", "OTPolicyName", obj.OTPolicyID); //ViewBag.ALPolicyID = new SelectList(DDService.GetLeavePolicy().Where(aa => aa.LeaveTypeID == 1).ToList().OrderBy(aa => aa.LeavePolicyName).ToList(), "PLeavePolicyID", "LeavePolicyName", obj.ALPolicyID); //ViewBag.SLPolicyID = new SelectList(DDService.GetLeavePolicy().Where(aa => aa.LeaveTypeID == 3).ToList().OrderBy(aa => aa.LeavePolicyName).ToList(), "PLeavePolicyID", "LeavePolicyName", obj.SLPolicyID); //ViewBag.CLPolicyID = new SelectList(DDService.GetLeavePolicy().Where(aa => aa.LeaveTypeID == 2).ToList().OrderBy(aa => aa.LeavePolicyName).ToList(), "PLeavePolicyID", "LeavePolicyName", obj.CLPolicyID); //ViewBag.CPLPolicyID = new SelectList(DDService.GetLeavePolicy().Where(aa => aa.LeaveTypeID == 4).ToList().OrderBy(aa => aa.LeavePolicyName).ToList(), "PLeavePolicyID", "LeavePolicyName", obj.CPLPolicyID); }
public ActionResult Delete(OUCommon obj) { if (ModelState.IsValid) { OUCommonService.PostDelete(obj); return(Json("OK", JsonRequestBehavior.AllowGet)); } return(PartialView("Delete", obj)); }
public ActionResult Edit(OUCommon obj) { if (obj.OUCommonName == null || obj.OUCommonName == "") { ModelState.AddModelError("OUCommonName", "Ou Common name cannot be empty"); } if (OUCommonService.GetIndex().Where(aa => aa.OUCommonName == obj.OUCommonName && aa.POUCommonID != obj.POUCommonID).Count() > 0) { ModelState.AddModelError("OUCommonName", "OU Common name must be unique"); } if (ModelState.IsValid) { OUCommonService.PostEdit(obj); return(Json("OK", JsonRequestBehavior.AllowGet)); } DDHelper(obj); return(PartialView("Edit", obj)); }