public async Task <IActionResult> UpdateBannerAsync([FromBody] UpdateBannerRequestDto request) { BannerBiz bannerBiz = new BannerBiz(); var entity = await bannerBiz.GetAsync(request.BannerGuid); if (entity == null) { return(Failed(ErrorCode.UserData, "找不到数据")); } entity.BannerName = request.BannerName; entity.OwnerGuid = request.OwnerGuid; entity.TargetUrl = request.TargetUrl; entity.PictureGuid = request.PictureGuid; entity.Description = request.Description; entity.Enable = request.Enable; entity.LastUpdatedDate = DateTime.Now; entity.Sort = request.Sort; var result = await bannerBiz.UpdateAsync(entity); if (!result) { return(Failed(ErrorCode.UserData, "修改失败")); } return(Success()); }
public async Task <IActionResult> DisableEnableBannerAsync([FromBody] DisableEnableBannerRequestDto request) { BannerBiz bannerBiz = new BannerBiz(); var entity = await bannerBiz.GetAsync(request.Guid); if (entity == null) { return(Failed(ErrorCode.UserData, "找不到数据")); } entity.LastUpdatedBy = UserID; entity.LastUpdatedDate = DateTime.Now; entity.Enable = request.Enable; var result = await bannerBiz.UpdateAsync(entity); if (!result) { return(Failed(ErrorCode.UserData, "修改失败")); } return(Success()); }