public IActionResult AddAgentToAgency(int id, [FromForm] Agent agent) { Agency agency = _agencyRepository.GetAgency(id); if (agency == null) { return(NotFound()); } try { _agencyRepository.AddAgentToAgency(id, agent); } catch (DbUpdateConcurrencyException) { if (agency == null) { return(NotFound()); } else { throw; } } return(NoContent()); }
public IActionResult PutAgentToAgency(int id, [FromBody] int agentId) { try { agencyRepo.AddAgentToAgency(id, agentId); return(Ok()); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex)); } }