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

            if (id != eventBoardStats.EventBoardStatsNo)
            {
                return BadRequest();
            }

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

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

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

            db.EventBoardStats.Add(eventBoardStats);
            await db.SaveChangesAsync();

            return CreatedAtRoute("DefaultApi", new { id = eventBoardStats.EventBoardStatsNo }, eventBoardStats);
        }