Esempio n. 1
0
        public IHttpActionResult Putpedido_maestro(int id, pedido_maestro pedido_maestro)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != pedido_maestro.uid_pedido_m)
            {
                return(BadRequest());
            }

            db.Entry(pedido_maestro).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!pedido_maestroExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
        public IHttpActionResult Postpedido_maestro(pedido_maestro pedido_maestro)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.pedido_maestro.Add(pedido_maestro);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (pedido_maestroExists(pedido_maestro.uid_pedido_m))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = pedido_maestro.uid_pedido_m }, pedido_maestro));
        }
Esempio n. 3
0
        public IHttpActionResult Getpedido_maestro(int id)
        {
            pedido_maestro pedido_maestro = db.pedido_maestro.Find(id);

            if (pedido_maestro == null)
            {
                return(NotFound());
            }

            return(Ok(pedido_maestro));
        }
Esempio n. 4
0
        public IHttpActionResult Deletepedido_maestro(int id)
        {
            pedido_maestro pedido_maestro = db.pedido_maestro.Find(id);

            if (pedido_maestro == null)
            {
                return(NotFound());
            }

            db.pedido_maestro.Remove(pedido_maestro);
            db.SaveChanges();

            return(Ok(pedido_maestro));
        }