//[Authorize(Policy = Policies.Admin)]
        public async Task <IActionResult> PutUser(int id, User user)
        {
            if (id != user.UserId)
            {
                return(BadRequest());
            }
            user.Password = CommunMethods.ConvertToEncrypt(user.Password);
            _context.Entry(user).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UserExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult <User> > PostUser(User user)
        {
            user.Password = CommunMethods.ConvertToEncrypt(user.Password);
            _context.User.Add(user);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetUser", new { id = user.UserId }, user));
        }
        User AuthenticateUser(string Email, string Password)
        {
            var pass = CommunMethods.ConvertToEncrypt(Password);
            //return await _context.UserInfo.FirstOrDefaultAsync(u => u.Email == email && u.Password == password)
            User user = _context.User.FirstOrDefault(u => u.Email == Email && u.Password == pass);

            //User user = User.SingleOrDefault(x => x.Email == loginCredentials.Email && x.Password == loginCredentials.Password);
            return(user);
        }