Ejemplo n.º 1
0
        public IHttpActionResult PutEventoTDB(long id, EventoTDB eventoTDB)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != eventoTDB.idEvento)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public IHttpActionResult GetEventoTDB(long id)
        {
            EventoTDB eventoTDB = db.EventoTDB.Find(id);

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

            return(Ok(eventoTDB));
        }
Ejemplo n.º 3
0
        public IHttpActionResult PostEventoTDB(EventoTDB eventoTDB)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.EventoTDB.Add(eventoTDB);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = eventoTDB.idEvento }, eventoTDB));
        }
Ejemplo n.º 4
0
        public IHttpActionResult DeleteEventoTDB(long id)
        {
            EventoTDB eventoTDB = db.EventoTDB.Find(id);

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

            db.EventoTDB.Remove(eventoTDB);
            db.SaveChanges();

            return(Ok(eventoTDB));
        }