コード例 #1
0
        public async Task <string> Handle(ChapterUploadCommand request, CancellationToken cancellationToken)
        {
            ChapterAdditionModel info = _mapper.Map <ChapterAdditionModel>(request);

            string id = await _repo.SaveChapterReturnId(info, cancellationToken);

            return(id);
        }
コード例 #2
0
ファイル: MangaWriteRepo.cs プロジェクト: GermanGolota/MangaL
        public async Task <string> SaveChapterReturnId(ChapterAdditionModel info, CancellationToken token)
        {
            string id  = CreateUniqueId();
            string sql = @"INSERT INTO Chapters(Id, ChapterName, ChapterNumber, MangaId)" +
                         @"VALUES(@Id, @ChapterName, @ChapterNumber, @MangaId)";
            var parameters = new
            {
                Id            = id,
                ChapterName   = info.ChapterName,
                ChapterNumber = info.ChapterNumber,
                MangaId       = info.MangaId
            };

            await _client.SaveData <dynamic>(sql, parameters, token);

            return(id);
        }