public string OnRegister(string email, string user, string pass) { RegisterView view = new RegisterView(); Validator validator = new Validator(); // Validate the user input here. if (!validator.Make(new string[] { email, user, pass }, new string[] { "email", "minLength:1", "minLength:8" }, new string[] { "email", "username", "password" })) { return view.Error(validator.GetDetail()); } UserRepository userRepo = new UserRepository(); int result = userRepo.Register(email, user, pass, 0); return view.Show(result); }
public string Store(string email, string user, string pass, int mode) { RegisterView view = new RegisterView(); Validator validator = new Validator(); // Validate the user input here. if (!validator.Make(new string[] { email, user, pass, mode + "" }, new string[] { "email", "required", "required", "required" }, new string[] { "email", "username", "password", "mode" })) { return view.Error(validator.GetDetail()); } int result = userRepo.Register(email, user, pass, mode); return view.Show(result); }