コード例 #1
0
        public IHttpActionResult PostMA_GRUPOS(MA_GRUPOS mA_GRUPOS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MA_GRUPOS.Add(mA_GRUPOS);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (MA_GRUPOSExists(mA_GRUPOS.c_CODIGO))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = mA_GRUPOS.c_CODIGO }, mA_GRUPOS));
        }
コード例 #2
0
        public IHttpActionResult PutMA_GRUPOS(string id, MA_GRUPOS mA_GRUPOS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != mA_GRUPOS.c_CODIGO)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public IHttpActionResult GetMA_GRUPOS(string id)
        {
            MA_GRUPOS mA_GRUPOS = db.MA_GRUPOS.Find(id);

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

            return(Ok(mA_GRUPOS));
        }
コード例 #4
0
        public IHttpActionResult DeleteMA_GRUPOS(string id)
        {
            MA_GRUPOS mA_GRUPOS = db.MA_GRUPOS.Find(id);

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

            db.MA_GRUPOS.Remove(mA_GRUPOS);
            db.SaveChanges();

            return(Ok(mA_GRUPOS));
        }