private async Task <bool> AddProfileImageToUserAndCheckCompletion(IFormFile file, TUser user) { var imageResult = await _imageService.SaveImage(file, FolderConstants.UserProfileImagesFolderName); if (imageResult.Success) { Image image = new Image { Url = $"/{FolderConstants.UserProfileImagesFolderName}/{imageResult.ImgUrl}", Name = $"{user.UserName}-Profile-Image" }; var addImgResult = await EntitiesService.CreateAsync(image); if (addImgResult.Successfull) { user.ProfileImage = image; return(true); } } return(false); }
/// <summary> /// Creates the specified entity in the database, as an asynchronous operation. /// </summary> /// <param name="entity">The entity to create.</param> /// <returns> /// A System.Threading.Tasks.Task that represents the result of the asynchronous query, containing the KerykeionCms.Services.KerykeionDbResult of the operation. /// </returns> public virtual async Task <KerykeionDbResult> CreateAsync(TEntity entity) { return(await EntitiesService.CreateAsync(entity)); }