Example #1
0
        public HttpResponseMessage AgregarJugador(DTOJugador dto)
        {
            try
            {
                TraductorJugador traductor = FabricaTraductor.CrearTraductorJugador();

                Entidad jugador = traductor.CrearEntidad(dto);

                Comando comando;

                comando = FabricaComando.CrearComandoAgregarJugador(jugador);

                comando.Ejecutar();

                return(new HttpResponseMessage(HttpStatusCode.OK));
            }
            catch (ObjetoNullException exc)
            {
                log.Error(exc, exc.Mensaje);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc.Mensaje));
            }
            catch (BaseDeDatosException exc)
            {
                log.Error(exc, exc.Mensaje);

                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc.Mensaje));
            }
            catch (Exception exc)
            {
                ExcepcionGeneral exceptionGeneral = new ExcepcionGeneral(exc.InnerException, DateTime.Now);
                log.Error(exc, exc.Message);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exceptionGeneral.Mensaje));
            }
        }