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

            if (id != priceListPart.PriceListPartId)
            {
                return(BadRequest());
            }

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

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

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

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

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

            db.PriceListParts.Add(priceListPart);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = priceListPart.PriceListPartId }, priceListPart));
        }
コード例 #4
0
        public async Task <IHttpActionResult> DeletePriceListPart(int id)
        {
            PriceListPart priceListPart = await db.PriceListParts.FindAsync(id);

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

            db.PriceListParts.Remove(priceListPart);
            await db.SaveChangesAsync();

            return(Ok(priceListPart));
        }