public Task <UpdateProductOffLineStatusResponse> UpdateOffLineStatusAsync(UpdateProductOffLineStatus dto) { return(Task.Run(() => { var pruoductEntity = _pruoductRepository.Table.Where(t => t.Id.Equals(dto.product_id)).SingleOrDefault(); if (pruoductEntity == null) { throw new RequestErrorException("该产品不存在!"); } pruoductEntity.OffLine = dto.off_line; _pruoductRepository.Update(pruoductEntity); return new UpdateProductOffLineStatusResponse(); })); }
public async Task <IHttpActionResult> Patch([FromBody] UpdateProductOffLineStatus dto) { var resp = _productService.UpdateOffLineStatusAsync(dto); return(Ok(resp)); }