public async Task <Photo> Handle(Command request, CancellationToken cancellationToken) { var photoUploadResult = _photoAccessor.AddUserPhoto(request.File); var user = await _context.Users.SingleOrDefaultAsync(x => x.UserName == _userAccessor.GetCurrentUsername()); var photo = new Photo { Url = photoUploadResult.Url, Id = photoUploadResult.PublicId }; user.Photo = photo; var success = await _context.SaveChangesAsync() > 0; if (success) { return(photo); } throw new Exception("데이터를 저장하는 동안 오류가 발생했습니다."); }