예제 #1
0
        public IHttpActionResult PostTR_VENTAS(TR_VENTAS tR_VENTAS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.TR_VENTAS.Add(tR_VENTAS);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (TR_VENTASExists(tR_VENTAS.c_DOCUMENTO))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = tR_VENTAS.c_DOCUMENTO }, tR_VENTAS));
        }
예제 #2
0
        public IHttpActionResult PutTR_VENTAS(string id, TR_VENTAS tR_VENTAS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tR_VENTAS.c_DOCUMENTO)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #3
0
        public IHttpActionResult GetTR_VENTAS(string id)
        {
            TR_VENTAS tR_VENTAS = db.TR_VENTAS.Find(id);

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

            return(Ok(tR_VENTAS));
        }
예제 #4
0
        public IHttpActionResult DeleteTR_VENTAS(string id)
        {
            TR_VENTAS tR_VENTAS = db.TR_VENTAS.Find(id);

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

            db.TR_VENTAS.Remove(tR_VENTAS);
            db.SaveChanges();

            return(Ok(tR_VENTAS));
        }