public async Task <IActionResult> UploadWallPaperAsync(WallpaperDto wallpaper) { #region 参数验证 Check.IfNullOrZero(wallpaper); #endregion var userContext = await GetUserContextAsync(); var(wapperId, url) = await _wallpaperServices.AddWallpaperAsync(new WallpaperDto { Title = wallpaper.Title.Substring(0, 9), Width = wallpaper.Width, Height = wallpaper.Height, Url = wallpaper.Url, Source = wallpaper.Source, UserId = userContext.Id, Md5 = wallpaper.Md5, ShortUrl = "" }); return(Json(new ResponseModel <dynamic> { Message = "壁纸上传成功", IsSuccess = true, Model = new { Id = wapperId, Url = Appsetting.FileUrl + url } })); }
public async Task <(Int32 wapperId, String url)> AddWallpaperAsync(WallpaperDto wallpaperDto) { Check.IfNullOrZero(wallpaperDto); return(await _wallpaperContext.AddWallpaperAsync(wallpaperDto.ConvertToModel <WallpaperDto, Wallpaper>())); }