예제 #1
0
        public IHttpActionResult PutResponsable(Responsable responsable)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            try
            {
                db.SaveChanges();
                return(Ok(true));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ResponsableExists(responsable.IdResponsable))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #2
0
        public IHttpActionResult PutActividad(Actividad actividad)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            try
            {
                db.SaveChanges();
                return(Ok(true));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ActividadExists(actividad.IdActividad))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #3
0
        public IHttpActionResult PutEstado(Estado estado)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            try
            {
                db.SaveChanges();
                return(Ok(true));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EstadoExists(estado.IdEstado))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
        }