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

            if (id != turfFecilityMaster.Id)
            {
                return(BadRequest());
            }

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

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

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

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

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

            db.TurfFecilityMasters.Add(turfFecilityMaster);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = turfFecilityMaster.Id }, turfFecilityMaster));
        }
コード例 #4
0
        public async Task <IHttpActionResult> DeleteTurfFecilityMaster(int id)
        {
            TurfFecilityMaster turfFecilityMaster = await db.TurfFecilityMasters.FindAsync(id);

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

            db.TurfFecilityMasters.Remove(turfFecilityMaster);
            await db.SaveChangesAsync();

            return(Ok(turfFecilityMaster));
        }