コード例 #1
0
        public async Task<IHttpActionResult> PutStoreReviewStats(int id, StoreReviewStats storeReviewStats)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != storeReviewStats.StoreReviewStatsNo)
            {
                return BadRequest();
            }

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StoreReviewStatsExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
コード例 #2
0
        public async Task<IHttpActionResult> PostStoreReviewStats(StoreReviewStats storeReviewStats)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.StoreReviewStats.Add(storeReviewStats);
            await db.SaveChangesAsync();

            return CreatedAtRoute("DefaultApi", new { id = storeReviewStats.StoreReviewStatsNo }, storeReviewStats);
        }