Пример #1
0
        public async Task <IHttpActionResult> PutOrdenos(int id, Ordenos ordenos)
        {
            OrdenosController ordenosController = this;

            if (!ordenosController.get_ModelState().get_IsValid())
            {
                return((IHttpActionResult)ordenosController.BadRequest(ordenosController.get_ModelState()));
            }
            if (id != ordenos.OrdenoId)
            {
                return((IHttpActionResult)ordenosController.BadRequest());
            }
            ((DbEntityEntry <Ordenos>)((DbContext)ordenosController.db).Entry <Ordenos>((M0)ordenos)).set_State((EntityState)16);
            try
            {
                int num = await((DbContext)ordenosController.db).SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                if (!ordenosController.OrdenosExists(id))
                {
                    return((IHttpActionResult)ordenosController.NotFound());
                }
                throw;
            }
            return((IHttpActionResult)ordenosController.StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
        public async Task <IHttpActionResult> DeleteOrdenos(int id)
        {
            OrdenosController ordenosController = this;
            Ordenos           ordenos           = await ordenosController.db.get_Ordenos().FindAsync(new object[1]
            {
                (object)id
            });

            if (ordenos == null)
            {
                return((IHttpActionResult)ordenosController.NotFound());
            }
            ordenosController.db.get_Ordenos().Remove(ordenos);
            int num = await((DbContext)ordenosController.db).SaveChangesAsync();

            return((IHttpActionResult)ordenosController.Ok <Ordenos>((M0)ordenos));
        }