public IActionResult Create([FromBody] PartnerCar PartnerCar) { 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")) { PartnerCar.Id = Guid.NewGuid() + ""; PartnerCar.IsDelete = false; return(Ok(_repository.Create(PartnerCar))); } } else { return(Forbid()); } return(Forbid()); }
public IActionResult Create([FromBody] PartnerCar PartnerCar) { PartnerCar.Id = Guid.NewGuid() + ""; return(Ok(_repository.Create(PartnerCar))); }