public IActionResult CountCondition(string condition)
        {
            var claims = User.Claims.Select(claim => new { claim.Type, claim.Value }).ToDictionary(t => t.Type, t => t.Value);

            if (claims.ContainsKey("name"))
            {
                if (claims["name"].Equals("ADMIN") || claims["name"].Equals("MANAGER"))
                {
                    return(Ok(_repository.CountCondition(condition)));
                }
            }
            else
            {
                return(Forbid());
            }
            return(Forbid());
        }
Esempio n. 2
0
 public IActionResult CountCondition(string condition)
 {
     return(Ok(_repository.CountCondition(condition)));
 }