Exemplo n.º 1
0
        public IHttpActionResult PostFavorito(int idTorneo, int idParticipante, Favorito favorito)
        {
            try
            {
                favorito.IDTorneo = idTorneo;
                favorito.IDParticipante = idParticipante;

                using (var proxy = new WSFavorito.FavoritoServiceClient())
                {
                    proxy.CrearFavorito(favorito);

                    return Ok(new
                    {
                        success = true
                    });
                }
            }
            catch (Exception ex)
            {
                return Ok(new
                {
                    success = false,
                    message = ex.Message
                });
            }
        }
Exemplo n.º 2
0
 public int CrearFavorito(Favorito favorito)
 {
     return this.ExecuteScalar<int>("usp_CrearFavorito",
         new DataParameter("@pIDTorneo", favorito.IDTorneo),
         new DataParameter("@pIDParticipante", favorito.IDParticipante),
         new DataParameter("@pIDContendor1", favorito.IDContendor1),
         new DataParameter("@pIDContendor2", favorito.IDContendor2),
         new DataParameter("@pIDGanador", favorito.IDGanador),
         new DataParameter("@pEtapa", favorito.Etapa)
     );
 }
Exemplo n.º 3
0
        public void CrearFavorito(Favorito favorito)
        {
            if (favorito.IDContendor1 == favorito.IDContendor2)
                throw new FaultException("Contendor 1 y 2 no pueden ser el mismo");

            if (favorito.IDGanador != favorito.IDContendor1 &&
                favorito.IDGanador != favorito.IDContendor2)
                throw new FaultException("El ganador no corresponde a los contendores");

            favoritoDA.CrearFavorito(favorito);

            var rutaCola = @".\private$\DSWarrior2";

            if (!MessageQueue.Exists(rutaCola))
            {
                MessageQueue.Create(rutaCola);
            }

            var cola = new MessageQueue(rutaCola);
            var mensaje = new Message();
            mensaje.Label = "Registrar Favorito";
            mensaje.Body = favorito;
            cola.Send(mensaje);
        }