本文整理汇总了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();
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}