public async Task <IHttpActionResult> PutCommodity(string id, Commodity commodity)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != commodity.ID)
            {
                return(BadRequest());
            }

            try
            {
                await _SVC.UpdateCommodity(commodity);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CommodityExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #2
0
 async public Task <ActionResult> Update(Commodity item)
 {
     return(Content(await _Service.UpdateCommodity(item)));
 }