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

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

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

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

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

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

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

            db.LimitDateShop.Add(limitDateShop);
            await db.SaveChangesAsync();

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

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

            db.LimitDateShop.Remove(limitDateShop);
            await db.SaveChangesAsync();

            return(Ok(limitDateShop));
        }