示例#1
0
        public Result ValidateLogOn(FitnessContext context, HttpRequest request, out User user)
        {
            Result result   = new Result();
            string password = request.Form["password"];
            string email    = request.Form["email"];
            User   newUser  = context.Users.Where(o => o.Email == email && o.Password == password).FirstOrDefault();

            if (newUser != default)
            {
                user           = newUser;
                result.Success = true;
            }
            else
            {
                user           = null;
                result.Success = false;
                result.ErrorMessages.Add("email or password is not correct.");
            }
            return(result);
        }
示例#2
0
        public Result TryLogIn(FitnessContext context, User user, ActiveUserManager activeUserManager)
        {
            Result result = new Result();

            try
            {
                user.Activities = (from u in context.Users
                                   join a in context.Activities
                                   on u.Id equals a.UserId
                                   select a).ToList();

                activeUserManager.ActiveUser = user;
                result.Success = true;
            }
            catch (Exception ex)
            {
                result.Success = false;
                result.ErrorMessages.Add(ex.Message);
            }
            return(result);
        }
示例#3
0
 public NewUserForm()
 {
     InitializeComponent();
     _context = new FitnessContext();
 }
 public ManageActivityTypesForm()
 {
     InitializeComponent();
     _context = new FitnessContext();
     WireUpList();
 }