当前位置: 首页>>代码示例>>C#>>正文


C# Validator.MatchRule方法代码示例

本文整理汇总了C#中Validator.MatchRule方法的典型用法代码示例。如果您正苦于以下问题:C# Validator.MatchRule方法的具体用法?C# Validator.MatchRule怎么用?C# Validator.MatchRule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Validator的用法示例。


在下文中一共展示了Validator.MatchRule方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Destroy

        /// <summary>
        /// Remove a absence record which has not been apply yet
        /// </summary>
        /// <returns></returns>
        public string Destroy(int id)
        {
            Validator validator = new Validator();
            if (!validator.MatchRule(id.ToString(), "required", "reasonId"))
            {
                return absenceView.Error(validator.GetDetail());
            }

            bool ret = absenceReasonRepo.Destroy(id, Auth.User().Id);

            return ret ? absenceView.Success() : absenceView.Error();
        }
开发者ID:soxfmr,项目名称:CourseSystem,代码行数:16,代码来源:AbsenceController.cs

示例2: AllUser

        public string AllUser(int mode)
        {
            Validator validator = new Validator();
            if (! validator.MatchRule(mode + "", "required", "mode"))
            {
                return view.Error(validator.GetDetail());
            }

            var result = userRepo.GetAllUserByMode(mode);

            return view.Show(result);
        }
开发者ID:soxfmr,项目名称:CourseSystem,代码行数:12,代码来源:UserManagerController.cs

示例3: Destroy

        public string Destroy(int id)
        {
            Validator validator = new Validator();
            // Validate the user input here.
            // Validate the user input here.
            if (!validator.MatchRule(id + "", "required", "id"))
            {
                return resultSetView.Error(validator.GetDetail());
            }

            bool ret = attendanceRepo.Destroy(id, Auth.User().Id);
            return ret ? resultSetView.Success() : resultSetView.Error();
        }
开发者ID:soxfmr,项目名称:CourseSystem,代码行数:13,代码来源:AttendanceController.cs

示例4: CreateDispatch

        public string CreateDispatch(int id)
        {
            GenericView view = new GenericView();
            DispatchRepository dispatchRepo = new DispatchRepository();

            Validator validator = new Validator();
            if (!validator.MatchRule(id + "", "required", "id"))
            {
                return view.Error(validator.GetDetail());
            }

            bool Ret = dispatchRepo.JoinCourse(Auth.User().Id, id);

            return Ret ? view.Success() : view.Error();
        }
开发者ID:soxfmr,项目名称:CourseSystem,代码行数:15,代码来源:UserController.cs

示例5: RemoveDispatch

        public string RemoveDispatch(string id)
        {
            GenericView view = new GenericView();
            DispatchRepository dispatchRepo = new DispatchRepository();

            Validator validator = new Validator();
            if (!validator.MatchRule(id, "required", "id"))
            {
                return view.Error(validator.GetDetail());
            }

            string[] idArr = id.Split(',');
            bool Ret = dispatchRepo.RemoveCourseList(Auth.User().Id, Array.ConvertAll(idArr, int.Parse));

            return Ret ? view.Success() : view.Error();
        }
开发者ID:soxfmr,项目名称:CourseSystem,代码行数:16,代码来源:UserController.cs

示例6: OnLogin

        public string OnLogin(string email, string pass, int mode)
        {
            LoginView view = new LoginView();
            Validator validator = new Validator();

            // Validate the user input here.
            if (!validator.MatchRule(email, "email", "email") )
            {
                return view.Error(validator.GetDetail());
            }

            UserRepository userRepo = new UserRepository();
            if (userRepo.Login(email, pass, mode))
            {
                return view.Show(userRepo.SessionId);
            }

            return view.Error();
        }
开发者ID:soxfmr,项目名称:CourseSystem,代码行数:19,代码来源:AuthController.cs


注:本文中的Validator.MatchRule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。