コード例 #1
0
        public ActionResult DetailPartial(int Id = 0)
        {
            AlertGroupModel alertGroupModel;

            alertGroupService = new AlertGroupService();

            if (Id == 0)
            {
                alertGroupModel           = alertGroupService.GetNewModel();
                alertGroupModel._FormMode = FormModeEnum.New;
            }
            else
            {
                alertGroupModel = alertGroupService.GetById(Id);
                if (alertGroupModel != null)
                {
                    alertGroupModel._FormMode = FormModeEnum.Edit;
                }
                else
                {
                    throw new Exception("[VALIDATION]-Data not exists");
                }
            }

            return(PartialView(VIEW_FORM_PARTIAL, alertGroupModel));
        }
コード例 #2
0
        public ActionResult Update([ModelBinder(typeof(DevExpressEditorsBinder))]  AlertGroupModel alertGroupModel)
        {
            alertGroupModel._UserId = (int)Session["userId"];

            alertGroupService         = new AlertGroupService();
            alertGroupModel._FormMode = FormModeEnum.Edit;



            if (ModelState.IsValid)
            {
                alertGroupService.Update(alertGroupModel);
                alertGroupModel = alertGroupService.GetById(alertGroupModel.Id);
            }
            else
            {
                string message = GetErrorModel();

                throw new Exception(string.Format("[VALIDATION] {0}", message));
            }

            return(PartialView(VIEW_FORM_PARTIAL, alertGroupModel));
        }