Example #1
0
        /*public KhoaModel Authenticate(string Khoaname, string password)
         * {
         *  var Khoa = _res.GetKhoa(Khoaname, password);
         *  // return null if Khoa not found
         *  if (Khoa == null)
         *      return null;
         *
         *  // authentication successful so generate jwt token
         *  var tokenHandler = new JwtSecurityTokenHandler();
         *  var key = Encoding.ASCII.GetBytes(Secret);
         *  var tokenDescriptor = new SecurityTokenDescriptor
         *  {
         *      Subject = new ClaimsIdentity(new Claim[]
         *      {
         *          new Claim(ClaimTypes.Name, Khoa.tenlop.ToString()),
         *      }),
         *      Expires = DateTime.UtcNow.AddDays(7),
         *      SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature)
         *  };
         *  var token = tokenHandler.CreateToken(tokenDescriptor);
         *
         *  return Khoa;
         *
         * }*/

        public KhoaModel GetDatabyID(string id)
        {
            return(_res.GetDatabyID(id));
        }