Ejemplo n.º 1
0
        public Return SetPassword(string password)
        {
            var returnObj = BaseMapper.GenerateReturn();

            password = password.Trim();
            var encryptedPassword = StringHelper.Encrypt(password);

            if (password != "")
            {
                this.Password = encryptedPassword;
            }
            else
            {
                returnObj = BaseMapper.GenerateReturn("Password cannot be blank");
            }

            return(returnObj);
        }
Ejemplo n.º 2
0
        /*public static IEnumerable<User> GetAll()
         * {
         *  return GetAll(MapperKey, () => GetDataModel().Users.OrderByDescending(i => i.DateCreated));
         * }*/

        public static User GetUserByCredentials(string username, string password)
        {
            var encryptedPassword = StringHelper.Encrypt(password);

            return(GetDataModel().Users.FirstOrDefault(item => (username == item.UserName) && (encryptedPassword == item.Password) && (item.IsActive)));
        }