示例#1
0
 public static TaskUserModel ToModel(UserEntity user)
 {
     return new TaskUserModel
     {
         UserId = user.Id,
         UserLogin = user.Login,
     };
 }
示例#2
0
 public static TaskUserModel ToModel(UserEntity user, int progress)
 {
     return new TaskUserModel
     {
         UserId = user.Id,
         UserLogin = user.Login,
         Progress = progress
     };
 }
示例#3
0
 public static TaskUserModel ToModel(TaskEntity task, UserEntity user)
 {
     return new TaskUserModel
     {
         UserId = user.Id,
         UserLogin = user.Login,
         TaskTitle = task.Title,
         TaskId = task.Id
     };
 }
示例#4
0
        public Identity(UserEntity user)
        {
            if (user == null)
            {
                Login = "******";
                return;
            }

            Id = user.Id;
            Login = user.Login;
            Email = user.Email;
        }
        /// <summary>
        /// create new user
        /// </summary>
        /// <returns>null if user exist</returns>
        public static UserEntity CreateUser(string login, string email, string password)
        {
            IKeyService<UserEntity> users = (IKeyService<UserEntity>)System.Web.Mvc.DependencyResolver.Current.GetService(typeof(IKeyService<UserEntity>));
            UserEntity membershipUser = null;

            if (null == FindUser(login, email))
            {
                UserEntity user = new UserEntity()
                            {
                                Id = Guid.NewGuid(),
                                Login = login,
                                Email = email,
                                Password = Crypto.HashPassword(password)
                            };
                users.Add(user);
                membershipUser = user;
            }

            return membershipUser;
        }