コード例 #1
0
        public IHttpActionResult PutSedeXTEC(int id, SedeXTEC sedeXTEC)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != sedeXTEC.IdSedeXTEC)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public IHttpActionResult GetSedeXTEC(int id)
        {
            SedeXTEC sedeXTEC = db.SedeXTECs.Find(id);

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

            return(Ok(sedeXTEC));
        }
コード例 #3
0
        public IHttpActionResult PostSedeXTEC(SedeXTEC sedeXTEC)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.SedeXTECs.Add(sedeXTEC);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = sedeXTEC.IdSedeXTEC }, sedeXTEC));
        }
コード例 #4
0
        public IHttpActionResult DeleteSedeXTEC(int id)
        {
            SedeXTEC sedeXTEC = db.SedeXTECs.Find(id);

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

            db.SedeXTECs.Remove(sedeXTEC);
            db.SaveChanges();

            return(Ok(sedeXTEC));
        }