示例#1
0
        public IHttpActionResult PutHistorialSE(int id, HistorialSE historialSE)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != historialSE.IDhistorialSe)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#2
0
        public IHttpActionResult GetHistorialSE(int id)
        {
            HistorialSE historialSE = db.HistorialSE.Find(id);

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

            return(Ok(historialSE));
        }
示例#3
0
        public IHttpActionResult PostHistorialSE(HistorialSE historialSE)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.HistorialSE.Add(historialSE);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = historialSE.IDhistorialSe }, historialSE));
        }
示例#4
0
        public IHttpActionResult DeleteHistorialSE(int id)
        {
            HistorialSE historialSE = db.HistorialSE.Find(id);

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

            db.HistorialSE.Remove(historialSE);
            db.SaveChanges();

            return(Ok(historialSE));
        }