示例#1
0
        public IHttpActionResult Post(Heroi heroi)
        {
            if (heroi.Id == 0)
            {
                heroi.Id = Id++;
                herois.Add(heroi);
                return(Ok());
            }

            return(BadRequest());
        }
示例#2
0
 public IHttpActionResult Post(Heroi heroi)
 {
     if (heroi == null)
     {
         return(BadRequest());
     }
     else
     {
         herois.Add(heroi);
         heroi.Id = ++id;
         return(Ok(heroi));
     }
 }
 public IHttpActionResult Post(Heroi heroi)
 {
     if (heroi.Id == 0)
     {
         return(BadRequest());
     }
     else
     {
         Herois.Add(heroi);
     }
     heroi.Id = contador++;
     return(Ok(heroi));
 }
示例#4
0
 public IHttpActionResult Post(Heroi heroi)
 {
     if (heroi != null)
     {
         heroi.Id = IDRef;
         herois.Add(heroi);
         IDRef++;
         return(Ok());
     }
     else
     {
         return(BadRequest());
     }
 }
        public IHttpActionResult Post(Heroi heroi)
        {
            if (heroi == null)
            {
                return(BadRequest());
            }

            // processador não vai trocar de tread, vai
            lock (objetoLock)
            {
                heroi.Id = IdGenerator++;
                Herois.Add(heroi);
            }
            return(Ok());
        }
示例#6
0
 public IHttpActionResult Post(Heroi heroi)
 {
     if (heroi == null)
     {
         return(BadRequest());
     }
     else
     {
         lock (objetoLock)
         {
             heroi.Id = ++IdContador;
             ListaHerois.Add(heroi);
         }
         return(Ok(heroi));
     }
 }
示例#7
0
 public IHttpActionResult Post(Heroi heroi)
 {
     if (heroi.Id == 0)
     {
         //Salva no banco de dados :)
         lock (objetoLock)
         {
             heroi.Id = contadorId++;
             herois.Add(heroi);
         }
         return(Ok(heroi));
     }
     else
     {
         return(BadRequest());
     }
 }
        public IHttpActionResult Post(Heroi heroi)
        {
            if (heroi == null)
            {
                return(BadRequest());
            }
            else
            {
                lock (@lock)
                {
                    herois.Add(heroi);
                    heroi.Id = contador++;
                }

                return(Ok(heroi));
            }
        }
        public IHttpActionResult Post(Heroi heroi)
        {
            if (heroi == null)
            {
                return(BadRequest());
            }
            else
            {
                lock (ObjLock) // thread safe
                {
                    heroi.Id = ++UltimoIdHeroi;
                    Herois.Add(heroi);
                }

                return(Ok(heroi));
            }
        }
示例#10
0
 public IHttpActionResult Post(Heroi heroi)
 {
     if (heroi.Id == 0)
     {
         lock (objetoLock)
         {
             QuantidadeHerois++;
             heroi.Id = QuantidadeHerois;
             Herois.Add(heroi);
             return(Ok());
         }
     }
     else
     {
         return(BadRequest());
     }
 }
 public IHttpActionResult Post(Heroi heroi)
 {
     heroi.Id = Id++;
     herois.Add(heroi);
     return(Ok());
 }
 public IHttpActionResult Post(Heroi heroi)
 {
     ListaHeroi.Add(heroi);
     heroi.Id = ++id;
     return(Ok("Herois Cadastrado"));
 }