コード例 #1
0
ファイル: Mapper.cs プロジェクト: ivailok/HaikuPubMVC
 public static Report MapHaikuReportingDtoToReport(HaikuReportingDto dto)
 {
     return(new Report()
     {
         Reason = dto.Reason,
         DateSent = DateTime.Now
     });
 }
コード例 #2
0
ファイル: HaikusService.cs プロジェクト: ivailok/HaikuPubMVC
        public async Task SendReport(int id, HaikuReportingDto dto)
        {
            var haiku = await this.UnitOfWork.HaikusRepository.GetByIdAsync(id).ConfigureAwait(false);

            var report = Mapper.MapHaikuReportingDtoToReport(dto);

            haiku.Reports.Add(report);
            await this.UnitOfWork.CommitAsync().ConfigureAwait(false);
        }