Пример #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;
 }
Пример #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;
 }
Пример #3
0
 public ItemsController()
 {
     db = new YearnlyEntities();
     loggedInUser = UserProfile.LoadUserByUserName(WebSecurity.CurrentUserName, db);
 }