예제 #1
0
        public async Task <IHttpActionResult> PutRetail_WebPage(int id, Retail_WebPage retail_WebPage)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != retail_WebPage.PageId)
            {
                return(BadRequest());
            }

            db.Entry(retail_WebPage).State = System.Data.Entity.EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #2
0
        public async Task <IHttpActionResult> GetRetail_WebPage(int id)
        {
            Retail_WebPage retail_WebPage = await db.Retail_WebPage.FindAsync(id);

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

            return(Ok(retail_WebPage));
        }
예제 #3
0
        public async Task <IHttpActionResult> PostRetail_WebPage(Retail_WebPage retail_WebPage)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Retail_WebPage.Add(retail_WebPage);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = retail_WebPage.PageId }, retail_WebPage));
        }
예제 #4
0
        public async Task <IHttpActionResult> DeleteRetail_WebPage(int id)
        {
            Retail_WebPage retail_WebPage = await db.Retail_WebPage.FindAsync(id);

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

            db.Retail_WebPage.Remove(retail_WebPage);
            await db.SaveChangesAsync();

            return(Ok(retail_WebPage));
        }