Beispiel #1
0
        public IHttpActionResult PostLOTE_FINAL(LOTE_FINAL lOTE_FINAL)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.LOTE_FINAL.Add(lOTE_FINAL);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (LOTE_FINALExists(lOTE_FINAL.CPF))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = lOTE_FINAL.CPF }, lOTE_FINAL));
        }
Beispiel #2
0
        public IHttpActionResult PutLOTE_FINAL(string id, LOTE_FINAL lOTE_FINAL)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != lOTE_FINAL.CPF)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #3
0
        public IHttpActionResult GetLOTE_FINAL(string id)
        {
            LOTE_FINAL lOTE_FINAL = db.LOTE_FINAL.Find(id);

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

            return(Ok(lOTE_FINAL));
        }
Beispiel #4
0
        public IHttpActionResult DeleteLOTE_FINAL(string id)
        {
            LOTE_FINAL lOTE_FINAL = db.LOTE_FINAL.Find(id);

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

            db.LOTE_FINAL.Remove(lOTE_FINAL);
            db.SaveChanges();

            return(Ok(lOTE_FINAL));
        }