Beispiel #1
0
 public IActionResult DeleteEnable(string id)
 {
     if (string.IsNullOrWhiteSpace(id))
     {
         return(BadRequest());
     }
     return(Ok(_repository.DeleteEnable(id)));
 }
Beispiel #2
0
        public IActionResult DeleteEnable(string id)
        {
            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") || claims["name"].Equals("PARTNER"))
                {
                    if (string.IsNullOrWhiteSpace(id))
                    {
                        return(BadRequest());
                    }
                    return(Ok(_repository.DeleteEnable(id)));
                }
            }
            else
            {
                return(Forbid());
            }
            return(Forbid());
        }