public static bool UserValidated(LogOnModel model) { var service = new Commanding.SimpleTwitterCommandServiceClient(); var readModel = new ReadModelService.SimpleTwitterReadModelServiceClient(); var user = readModel.GetUsers().Where(n => n.Username == model.UserName).SingleOrDefault(); if (user == null) { return false; } service.ValidateUser(new ValidateUserCommand() { UserID = user.Id, Username = model.UserName, Password = model.Password }); bool validated = readModel.UserValidated(user.Id); return validated; }
public static bool UserValidated(LogOnModel model) { var service = new Commanding.SimpleTwitterCommandServiceClient(); var readModel = new ReadModelService.SimpleTwitterReadModelServiceClient(); var user = readModel.GetUsers().Where(n => n.Username == model.UserName).SingleOrDefault(); if (user == null) { return(false); } service.ValidateUser(new ValidateUserCommand() { UserID = user.Id, Username = model.UserName, Password = model.Password }); bool validated = readModel.UserValidated(user.Id); return(validated); }
public ActionResult Validate(string username, string submittedPassword) { var service = new Commanding.SimpleTwitterCommandServiceClient(); var readModel = new ReadModelService.SimpleTwitterReadModelServiceClient(); var user = readModel.GetUsers().Where(n => n.Username == username).SingleOrDefault(); if (user == null) { return(View(false)); } service.ValidateUser(new Commands.ValidateUserCommand() { UserID = user.Id, Username = username, Password = submittedPassword }); bool result = readModel.UserValidated(user.Id); return(View(result)); }
public ActionResult Validate(string username, string submittedPassword) { var service = new Commanding.SimpleTwitterCommandServiceClient(); var readModel = new ReadModelService.SimpleTwitterReadModelServiceClient(); var user = readModel.GetUsers().Where(n => n.Username == username).SingleOrDefault(); if (user == null) { return View(false); } service.ValidateUser(new Commands.ValidateUserCommand() { UserID = user.Id, Username = username, Password = submittedPassword }); bool result = readModel.UserValidated(user.Id); return View(result); }