Exemplo n.º 1
0
        public static UserModel GetModelFromUser(User user)
        {
            if (user == null)
                return null;

            var roles = user.Roles.ToList().GetRoleModelsFromRoles();
            var ministries = user.Ministries.ToList().GetMinstryModelsFromMinistries();
            return new UserModel
            {
                FirstName = user.FirstName,
                LastName = user.LastName,
                ScreenName = user.ScreenName,
                Email = user.Email,
                Link = user.Link,
                AccessToken= user.AccessToken,
                FacebookId = user.FacebookId,
                UserStatus = user.UserStatusEnum,
                LastAcecssed = user.LastAccessed,
                Created = user.Created,
                Id = user.Id,
                IdKey = user.IdKey,
                Roles = roles,
                MultiSelectRoleList = ManageRoleModelHelper.GetMultiSelectedRoles(roles),
                Ministries = ministries,
                MultiSelectMinistryList = ManageMinistryModelHelper.GetMultiSelectedMinistries(ministries),
            };
        }
Exemplo n.º 2
0
        public static User GetUserFromModel(UserModel model, DbContextHelper db)
        {
            if (model == null)
                return null;

            User user = new User
            {
                FirstName = model.FirstName,
                LastName = model.LastName,
                ScreenName = model.ScreenName,
                Email = model.Email,
                Link = model.Link,
                AccessToken = model.AccessToken,
                FacebookId = model.FacebookId,                
                UserStatusEnum = model.UserStatus,
                LastAccessed = model.LastAcecssed,
                Created = model.Created,
                Id = model.Id,
                Roles = ManageRoleModelHelper.GetRolesFromModel(model.Roles, db)
            };

            return user;
        }
Exemplo n.º 3
0
 private static UserModel GetModelFromUser(User user)
 {
     try
     {
         return ManageUserModelHelper.GetModelFromUser(user);
     }
     catch (Exception ex)
     {
         LogHelper.LogFatalError("UserModelHelper.GetModelFromUser", ex);
         throw ex;
     }
 }