public async Task <IHttpActionResult> UpdateProduct([FromUri] int id, [FromBody] UpdateStoreItemRequest updateRequest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await _storeItemService.UpdateStoreItemAsync(id, updateRequest);

            return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NoContent)));
        }
示例#2
0
        public async Task <IHttpActionResult> AddStoreItemAsync([FromBody] UpdateStoreItemRequest createRequest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var item = await _storeItemService.CreateStoreItemAsync(createRequest);

            var location = string.Format("/api/storeItem/{0}", item.Id);

            return(Created <StoreItem>(location, item));
        }