Пример #1
0
        public IHttpActionResult PutTMCENTROS(int id, TMCENTROS tMCENTROS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tMCENTROS.Id_Centro)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
        public IHttpActionResult GetTMCENTROS(int id)
        {
            TMCENTROS tMCENTROS = db.TMCENTROes.Find(id);

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

            return(Ok(tMCENTROS));
        }
Пример #3
0
        public IHttpActionResult PostTMCENTROS(TMCENTROS tMCENTROS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.TMCENTROes.Add(tMCENTROS);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = tMCENTROS.Id_Centro }, tMCENTROS));
        }
Пример #4
0
        public IHttpActionResult DeleteTMCENTROS(int id)
        {
            TMCENTROS tMCENTROS = db.TMCENTROes.Find(id);

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

            db.TMCENTROes.Remove(tMCENTROS);
            db.SaveChanges();

            return(Ok(tMCENTROS));
        }