Esempio n. 1
0
        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());
        }
Esempio n. 2
0
 public IActionResult PutAgentToAgency(int id, [FromBody] int agentId)
 {
     try
     {
         agencyRepo.AddAgentToAgency(id, agentId);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, ex));
     }
 }