public IActionResult DeleteEnable(string id) { if (string.IsNullOrWhiteSpace(id)) { return(BadRequest()); } return(Ok(_repository.DeleteEnable(id))); }
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")) { if (string.IsNullOrWhiteSpace(id)) { return(BadRequest()); } return(Ok(_repository.DeleteEnable(id))); } } else { return(Forbid()); } return(Forbid()); }