コード例 #1
0
        public IHttpActionResult PostCREDIT_STATUS(CREDIT_STATUS cREDIT_STATUS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CREDIT_STATUS.Add(cREDIT_STATUS);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (CREDIT_STATUSExists(cREDIT_STATUS.CSTATUS_ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = cREDIT_STATUS.CSTATUS_ID }, cREDIT_STATUS));
        }
コード例 #2
0
        public IHttpActionResult PutCREDIT_STATUS(short id, CREDIT_STATUS cREDIT_STATUS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != cREDIT_STATUS.CSTATUS_ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public IHttpActionResult GetCREDIT_STATUS(short id)
        {
            CREDIT_STATUS cREDIT_STATUS = db.CREDIT_STATUS.Find(id);

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

            return(Ok(cREDIT_STATUS));
        }
コード例 #4
0
        public IHttpActionResult DeleteCREDIT_STATUS(short id)
        {
            CREDIT_STATUS cREDIT_STATUS = db.CREDIT_STATUS.Find(id);

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

            db.CREDIT_STATUS.Remove(cREDIT_STATUS);
            db.SaveChanges();

            return(Ok(cREDIT_STATUS));
        }