Ejemplo n.º 1
0
 public ActionResult AddAgent(AgentResource agentResource)
 {
     try
     {
         var agent = mapper.Map <Agent>(agentResource);
         serviceAgent.AddAgent(agent);
         return(Ok(agent));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Ejemplo n.º 2
0
        public IActionResult Register(AgentRegister agentRegister)
        {
            try
            {
                if (agentRegister.Fonction != Domain.Models.Types.AgentFunction.Directeur)
                {
                    var agent = mapper.Map <Agent>(agentRegister);
                    serviceAgent.AddAgent(agent);
                }
                var agentToRegister = mapper.Map <ApplicationUser>(agentRegister);
                serviceAuthentification.Registry(agentToRegister, agentRegister.Password, agentRegister.VehiculeId);

                return(Ok(agentRegister));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }