예제 #1
0
        public ActionResult Add([ModelBinder(typeof(DevExpressEditorsBinder))]  AlertGroupModel alertGroupModel)
        {
            alertGroupModel._UserId = (int)Session["userId"];


            alertGroupService = new AlertGroupService();


            if (ModelState.IsValid)
            {
                alertGroupService.Add(alertGroupModel);
                alertGroupModel = alertGroupService.GetNewModel();
            }
            else
            {
                string message = GetErrorModel();

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


            alertGroupModel._FormMode = Models.FormModeEnum.New;

            return(PartialView(VIEW_FORM_PARTIAL, alertGroupModel));
        }
예제 #2
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));
        }