コード例 #1
0
        public IHttpActionResult PostMA_BANCOS(MA_BANCOS mA_BANCOS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MA_BANCOS.Add(mA_BANCOS);

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

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

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

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

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

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

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

            return(Ok(mA_BANCOS));
        }
コード例 #4
0
        public IHttpActionResult DeleteMA_BANCOS(string id)
        {
            MA_BANCOS mA_BANCOS = db.MA_BANCOS.Find(id);

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

            db.MA_BANCOS.Remove(mA_BANCOS);
            db.SaveChanges();

            return(Ok(mA_BANCOS));
        }