public async Task <IActionResult> Login([FromBody] LoginCredential c)
        {
            string token = null;

            /*
             * using (var reader = new StreamReader(Request.Body))
             * {
             *  try
             *  {
             *      var body = await reader.ReadToEndAsync(); // reader.ReadToEnd();
             *  }
             *  catch (Exception e)
             *  {
             *  }
             *
             *  // Do something else
             * }
             */
            if (c.Uname != null && c.Upassword != null)
            {
                var admin = await _context.Administrator.FirstOrDefaultAsync(
                    a => a.Uname == c.Uname && a.Upassword == c.Upassword);

                if (admin != null)
                {
                    var adminRole = await _context.AdminRole.FirstOrDefaultAsync(a => a.AdminLevel.ToString() == admin.AdminLevel.ToString());

                    token = JwtHelper.GenrateJwtTokenForLibraryAdmin(admin.AdminId.ToString(), System.Convert.ToString(adminRole), _config["Jwt:Key"]);
                    return(Ok(new { token }));
                }
            }

            return(BadRequest(new { message = "Username or password is incorrect." }));
        }
        public async Task <IActionResult> Login([FromBody] LoginCredential c)
        {
            string token = null;

            if (c.Uname != null && c.Upassword != null)
            {
                var admin = await _context.Administrator.FirstOrDefaultAsync(
                    a => string.Equals(a.Uname, c.Uname) && a.Upassword == CryptoHelper.Hash(c.Upassword));

                if (admin != null)
                {
                    var adminRole = await _context.AdminRole.FirstOrDefaultAsync(a => a.AdminLevel.ToString() == admin.AdminLevel.ToString());

                    token = JwtHelper.GenrateJwtTokenForLibraryAdmin(admin.AdminId.ToString(), System.Convert.ToString(adminRole.AdminRole1), _config["Jwt:Key"]);
                    return(Ok(new { token }));
                }
            }

            return(BadRequest(new { message = "Username or password is incorrect." }));
        }