public Task <UpdateProductHotStatusResponse> UpdateHotStatusAsync(UpdateProductHotStatus dto) { return(Task.Run(() => { var pruoductEntity = _pruoductRepository.Table.Where(t => t.Id.Equals(dto.product_id)).SingleOrDefault(); if (pruoductEntity == null) { throw new RequestErrorException("该产品不存在!"); } var productMeta = _pruoductMetaRepository.Table.Where(t => t.PruductId.Equals(dto.product_id)).SingleOrDefault(); productMeta.IsHot = dto.is_hot; _pruoductMetaRepository.Update(productMeta); return new UpdateProductHotStatusResponse(); })); }
public async Task <IHttpActionResult> Patch([FromBody] UpdateProductHotStatus dto) { var resp = _productService.UpdateHotStatusAsync(dto); return(Ok(resp)); }