public ActionResult DetailPartial(int Id = 0) { ApprovalModel approvalModel; approvalService = new ApprovalService(); if (Id == 0) { approvalModel = approvalService.GetNewModel(); approvalModel._FormMode = FormModeEnum.New; } else { approvalModel = approvalService.GetById(Id); if (approvalModel != null) { approvalModel._FormMode = FormModeEnum.Edit; } else { throw new Exception("[VALIDATION]-Data not exists"); } } return(PartialView(VIEW_FORM_PARTIAL, approvalModel)); }
public ActionResult Update([ModelBinder(typeof(DevExpressEditorsBinder))] ApprovalModel approvalModel) { approvalModel._UserId = (int)Session["userId"]; approvalService = new ApprovalService(); approvalModel._FormMode = FormModeEnum.Edit; if (ModelState.IsValid) { approvalService.Update(approvalModel); approvalModel = approvalService.GetById(approvalModel.Id); } else { string message = GetErrorModel(); throw new Exception(string.Format("[VALIDATION] {0}", message)); } return(PartialView(VIEW_FORM_PARTIAL, approvalModel)); }