/// <summary> /// 根据商品ID 和 版本ID删除购物车中对应的商品 /// </summary> public async Task <DelProductResponse> DelProductAsync([FromBody] DelProductRequest request) { DelProductResponse response = new DelProductResponse(); try { var shopCarList = _context.CarListEntitys.Where(a => a.ProductID == request.ProductId && a.VersionID == request.VersionId); _context.CarListEntitys.RemoveRange(shopCarList); await _context.SaveChangesAsync(); } catch (Exception ex) { response.Successful = false; response.Message = ex.Message; logger.LogError(ex, $"DelProductAsync方法报错 Message:{JsonConvert.SerializeObject(request)}"); } return(response); }
public async Task <DelProductResponse> DelProductAsync(DelProductRequest request) { string url = $"{configuration["ServiceAddress:Service.ShopCar"]}{configuration["MehtodName:ShopCar.ShopCarOperation.DelProductAsync"]}"; return(await apiHelperService.PostAsync <DelProductResponse>(url, request)); }