Ejemplo n.º 1
0
 /// <summary>
 /// Converts a User from the private service to an ad from the public service.
 /// (Literally no difference apart from reference type).
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public static User Convert(this SaServicePrivate.User user)
 {
     return(new User
     {
         Id = user.Id,
         Email = user.Email,
         Name = user.Name,
         DateRegistered = user.DateRegistered,
         Boosts = user.Boosts,
         Reservations = user.Reservations,
         PictureURL = user.PictureURL,
         //The rest of the properties aren't important or aren't even transmitted
         //through the WCF service.
     });
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Updates user details to the ones from the database and returns them.
        /// </summary>
        /// <returns></returns>
        public static SaServicePrivate.User GetUpdatedCurrentUserDetails()
        {
            if (AuthHelper.IsLoggedIn())
            {
                SaServicePrivate.User user = null;
                using (var client = ServiceHelper.GetServiceClientLoggedIn())
                {
                    user = client.GetCurrentUser();
                    AuthHelper.CurrentUserDetails = user;
                }

                return(user);
            }
            else
            {
                return(null);
            }
        }