public async Task <IActionResult> UpdateOnlieCategory(string productGuid) { if (string.IsNullOrEmpty(productGuid)) { return(Failed(ErrorCode.UserData, "参数不正确")); } var productBiz = new ProductBiz(); var model = await productBiz.GetAsync(productGuid); if (model is null) { return(Failed(ErrorCode.UserData, "商品不存在")); } model.PlatformOnSale = !model.PlatformOnSale; //如何后台启用商品则不修改商户端状态 if (!model.PlatformOnSale) { model.OnSale = model.PlatformOnSale; } var result = await productBiz.UpdateAsync(model); return(result ? Success() : Failed(ErrorCode.DataBaseError, "更新失败!")); }
public async Task <IActionResult> UpdateRecommend(string productGuid) { if (string.IsNullOrEmpty(productGuid)) { return(Failed(ErrorCode.UserData, "参数不正确")); } var productBiz = new ProductBiz(); var model = await productBiz.GetAsync(productGuid); if (model is null) { return(Failed(ErrorCode.UserData, "商品不存在")); } model.Recommend = !model.Recommend; var result = await productBiz.UpdateAsync(model); return(result ? Success() : Failed(ErrorCode.DataBaseError, "更新失败!")); }
public async Task <IActionResult> UpdateRecommendSort([FromBody] UpdateProductSortRequestDto requestDto) { if (string.IsNullOrEmpty(requestDto.ProductGuid)) { return(Failed(ErrorCode.UserData, "参数不正确")); } var productBiz = new ProductBiz(); var model = await productBiz.GetAsync(requestDto.ProductGuid); if (model is null) { return(Failed(ErrorCode.UserData, "商品不存在")); } model.Sort = requestDto.Sort; var result = await productBiz.UpdateAsync(model); return(result ? Success() : Failed(ErrorCode.DataBaseError, "更新失败!")); }