예제 #1
0
        public async Task <NewAvatarDto> UpdateAvatarAsync(int eventId, IFormFile file)
        {
            var path = $"wwwroot/EventAvatar/{eventId}/{file.FileName}";
            await _imageSaver
            .SaveWithSpecifiedName(file, path);

            var newAvatar = new NewAvatarDto {
                Avatar = path
            };

            _repository.Event.UpdateById(eventId, newAvatar);
            await _repository.SaveAsync();

            return(newAvatar);
        }