Exemplo n.º 1
0
 public UserFM GetUserFM(int ID)
 {
     UserDAO dao = new UserDAO();
     User user = dao.GetUserByID(ID);
     UserFM userFM = new UserFM(user);
     return userFM;
 }
Exemplo n.º 2
0
 public ActionResult Edit(UserFM userFM)
 {
     //if user valid edit user
     UserService users = new UserService();
     users.UpdateUser(userFM);
     return RedirectToAction("Index");
     //else return edit with errors
 }
Exemplo n.º 3
0
 public ActionResult Create(UserFM user)
 {
     //if user valid create user
     UserService users = new UserService();
     users.CreateUser(user);
     return RedirectToAction("Index");
     //else return to create with errors
 }
Exemplo n.º 4
0
 public bool IsValidUser(UserFM userFM)
 {
     UserDAO dao = new UserDAO();
     if(userFM.Email != null && userFM.Email.Length > 5 && dao.GetUserByEmail(userFM.Email) == null)
     {
         return true;
     }
     return false;
 }
Exemplo n.º 5
0
        public User ConvertUser(UserFM userFM)
        {
            User user = new User();

            user.FirstName = userFM.FirstName;
            user.LastName  = userFM.LastName;
            user.Email     = userFM.Email;
            user.Password  = userFM.Password;
            return(user);
        }
Exemplo n.º 6
0
        public UserVM Login(UserFM userFM)
        {
            UserDAO dao  = new UserDAO();
            User    user = dao.GetUserByEmail(userFM.Email);

            if (user.Password == userFM.Password)
            {
                UserVM userVM = ConvertUser(user);
                return(userVM);
            }
            return(null);
        }
Exemplo n.º 7
0
 //public User ConvertUser(UserFM user)
 //{
 //    User userDAO = new User();
 //    userDAO.Email = user.Email;
 //}
 public bool CreateUser(UserFM userFM)
 {
     if (IsValidUser(userFM))
     {
         //email temp pass to user
         UserDAO dao = new UserDAO();
         User user = new User();
         user.Email = userFM.Email;
         user.Password = RandomPassword();
         dao.CreateUser(user);
         return true;
     }
     return false;
 }
Exemplo n.º 8
0
 public void UpdateUser(UserFM userFM)
 {
     UserDAO dao = new UserDAO();
     User user = dao.GetUserByID(userFM.ID);
     user.Email = userFM.Email;
     dao.UpdateUser(user);
 }
Exemplo n.º 9
0
        public void CreateUser(UserFM userFM)
        {
            UserDAO dao = new UserDAO();

            dao.CreateUser(ConvertUser(userFM));
        }