示例#1
0
        public IHttpActionResult PutDetallesComision(int id, DetallesComision detallesComision)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != detallesComision.Id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#2
0
        public IHttpActionResult GetDetallesComision(int id)
        {
            DetallesComision detallesComision = db.DetallesComision.Find(id);

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

            return(Ok(detallesComision));
        }
示例#3
0
        public IHttpActionResult PostDetallesComision(DetallesComision detallesComision)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.DetallesComision.Add(detallesComision);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = detallesComision.Id }, detallesComision));
        }
示例#4
0
        public IHttpActionResult DeleteDetallesComision(int id)
        {
            DetallesComision detallesComision = db.DetallesComision.Find(id);

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

            db.DetallesComision.Remove(detallesComision);
            db.SaveChanges();

            return(Ok(detallesComision));
        }