예제 #1
0
        /// <summary>
        /// Adds the user.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <returns>
        /// It return 1 if user added successfully
        /// </returns>
        public Task <int> AddUser(User user)
        {
            var encriptPWd = EncriptAndDecript.base64Encode(user.Password);

            user.Password = encriptPWd;
            this.userDbContext.Users.Add(user);
            var result = this.userDbContext.SaveChangesAsync();

            return(result);
        }
예제 #2
0
        /// <summary>
        /// Logins the specified email.
        /// </summary>
        /// <param name="email">The email.</param>
        /// <param name="password">The password.</param>
        /// <returns>
        /// It return true if Login successful.
        /// </returns>u
        public bool Login(User userChanges)
        {
            var decriptPWD = EncriptAndDecript.base64Decode(userChanges.Password);
            var result     = this.userDbContext.Users.Where(id => id.Email == userChanges.Email && id.Password == userChanges.Password).FirstOrDefault();

            if (result != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }