Exemple #1
0
        public async Task <ApiResult> EditProfilePicture(EditProfileImageMessage message)
        {
            try
            {
                var id = User.Claims.First(c => c.Type == ClaimTypes.Name).Value.ToString();

                //if (message.OldImage != null) _fileManagementService.DeleteOldProfileImage(id, message.NewImage, DataType.Profile);

                await _fileManagementService.SaveProfileImage(id, message.Image, DataType.Profile);

                return(ApiResult.Success(null, "Image successfully changed"));
            }
            catch (System.Exception)
            {
                return(ApiResult.BadRequest("Something went wrong"));
            }
        }