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

            if (id != playerRequestedGroup.ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public async Task <IHttpActionResult> GetPlayerRequestedGroup(int id)
        {
            PlayerRequestedGroup playerRequestedGroup = await db.PlayerRequestedGroup.FindAsync(id);

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

            return(Ok(playerRequestedGroup));
        }
コード例 #3
0
        public async Task <IHttpActionResult> PostPlayerRequestedGroup(PlayerRequestedGroup playerRequestedGroup)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PlayerRequestedGroup.Add(playerRequestedGroup);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = playerRequestedGroup.ID }, playerRequestedGroup));
        }
コード例 #4
0
        public async Task <IHttpActionResult> DeletePlayerRequestedGroup(int id)
        {
            PlayerRequestedGroup playerRequestedGroup = await db.PlayerRequestedGroup.FindAsync(id);

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

            db.PlayerRequestedGroup.Remove(playerRequestedGroup);
            await db.SaveChangesAsync();

            return(Ok(playerRequestedGroup));
        }