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

            if (id != appreciationAgree.AppreciationAgreeId)
            {
                return(BadRequest());
            }

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

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

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

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

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

            db.AppreciationAgrees.Add(appreciationAgree);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = appreciationAgree.AppreciationAgreeId }, appreciationAgree));
        }
コード例 #4
0
        public async Task <IHttpActionResult> DeleteAppreciationAgree(int id)
        {
            AppreciationAgree appreciationAgree = await db.AppreciationAgrees.FindAsync(id);

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

            db.AppreciationAgrees.Remove(appreciationAgree);
            await db.SaveChangesAsync();

            return(Ok(appreciationAgree));
        }