Exemplo n.º 1
0
        public IHttpActionResult PutLIteral(int id, LIteral lIteral)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != lIteral.NumeroId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public IHttpActionResult GetLIteral(int id)
        {
            LIteral lIteral = db.LIterals.Find(id);

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

            return(Ok(lIteral));
        }
Exemplo n.º 3
0
        public IHttpActionResult PostLIteral(LIteral lIteral)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.LIterals.Add(lIteral);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = lIteral.NumeroId }, lIteral));
        }
Exemplo n.º 4
0
        public IHttpActionResult DeleteLIteral(int id)
        {
            LIteral lIteral = db.LIterals.Find(id);

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

            db.LIterals.Remove(lIteral);
            db.SaveChanges();

            return(Ok(lIteral));
        }