Ejemplo n.º 1
0
        public IHttpActionResult PutPercepcaoTDB(long id, PercepcaoTDB percepcaoTDB)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != percepcaoTDB.idPercepcao)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public IHttpActionResult GetPercepcaoTDB(long id)
        {
            PercepcaoTDB percepcaoTDB = db.PercepcaoTDB.Find(id);

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

            return(Ok(percepcaoTDB));
        }
Ejemplo n.º 3
0
        public IHttpActionResult PostPercepcaoTDB(PercepcaoTDB percepcaoTDB)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PercepcaoTDB.Add(percepcaoTDB);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = percepcaoTDB.idPercepcao }, percepcaoTDB));
        }
Ejemplo n.º 4
0
        public IHttpActionResult DeletePercepcaoTDB(long id)
        {
            PercepcaoTDB percepcaoTDB = db.PercepcaoTDB.Find(id);

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

            db.PercepcaoTDB.Remove(percepcaoTDB);
            db.SaveChanges();

            return(Ok(percepcaoTDB));
        }