protected models.User GetDbUser(string token)
        {
            var user = new models.User()
            {
                UserName = UserName,
                Salt     = "salt",
                Password = this.Password,
                Email    = "*****@*****.**",
                Token    = token
            };

            return(user);
        }
        public User ConvertDbUserToUser(models.User dbUser)
        {
            var user = new User()
            {
                UserId   = dbUser.UserId,
                UserName = dbUser.UserName,
                Salt     = dbUser.Salt,
                Password = dbUser.Password,
                Email    = dbUser.Email,
                Token    = dbUser.Token
            };

            return(user);
        }
Esempio n. 3
0
        public int AddUser(User user)
        {
            var dbUser = new models.User
            {
                UserName   = user.UserName,
                Email      = user.Email,
                PassWord   = user.Password,
                Salt       = user.Salt,
                Created    = DateTime.Now.ToUniversalTime(),
                CreatedBy  = "Website",
                Modified   = DateTime.Now.ToUniversalTime(),
                ModifiedBy = "Website"
            };

            this.context.User.Add(dbUser);
            this.context.SaveChanges();

            return(dbUser.UserId);
        }