Exemplo n.º 1
0
 //This method will either load a user or load an empty user.
 public static UserProfile LoadUserByUserName(String userName, YearnlyEntities db)
 {
     UserProfile returnedUser = new UserProfile();
     UserProfile user = db.UserProfiles.Where(up => up.UserName == userName).FirstOrDefault();
     if (user != null)
     {
         returnedUser = user;
     }
     return returnedUser;
 }
Exemplo n.º 2
0
 public static UserProfile LoadUserByUserId(int userId, YearnlyEntities db)
 {
     UserProfile returnedUser = new UserProfile();
     returnedUser = db.UserProfiles.Where(up => up.UserId == userId).FirstOrDefault();
     return returnedUser;
 }
Exemplo n.º 3
0
 public ItemsController()
 {
     db = new YearnlyEntities();
     loggedInUser = UserProfile.LoadUserByUserName(WebSecurity.CurrentUserName, db);
 }