コード例 #1
0
        public IHttpActionResult Patch([FromODataUri] decimal key, Delta <USERFUND> patch)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            USERFUND uSERFUND = db.USERFUNDS.Find(key);

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

            patch.Patch(uSERFUND);

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

            return(Updated(uSERFUND));
        }
コード例 #2
0
        // PUT: odata/USERFUNDs(5)
        public IHttpActionResult Put([FromODataUri] decimal key, USERFUND uSERFUND)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (key != uSERFUND.ID)
            {
                return(BadRequest());
            }

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

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

            return(Updated(uSERFUND));
        }
コード例 #3
0
        // POST: odata/USERFUNDs
        public IHttpActionResult Post(USERFUND uSERFUND)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.USERFUNDS.Add(uSERFUND);
            db.SaveChanges();

            return(Created(uSERFUND));
        }
コード例 #4
0
        // DELETE: odata/USERFUNDs(5)
        public IHttpActionResult Delete([FromODataUri] decimal key)
        {
            USERFUND uSERFUND = db.USERFUNDS.Find(key);

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

            db.USERFUNDS.Remove(uSERFUND);
            db.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }