Ejemplo n.º 1
0
        public async Task <OddDto> UpdateAsync(OddDto dto)
        {
            var entity = InverseMap(dto);
            await _oddsRepository.UpdateAsync(entity);

            await _oddsRepository.UpdateAsync(entity.OddValues);

            return(Map(entity));
        }
Ejemplo n.º 2
0
 public static OddsViewModel InverseOddsViewModelMap(OddDto dto)
 {
     return(new OddsViewModel()
     {
         OddsName = $"{dto.HomeTeamName} vs {dto.AwayTeamName}",
         HomeTeamName = dto.HomeTeamName,
         AwayTeamName = dto.AwayTeamName,
         OddValues = new OddValuesViewModel()
         {
             HomeOddValue = dto.OddValues.HomeOddValue,
             DrawOddValue = dto.OddValues.DrawOddValue,
             AwayOddValue = dto.OddValues.AwayOddValue,
         }
     });
 }
Ejemplo n.º 3
0
 private Odd InverseMap(OddDto dto)
 {
     return(new Odd()
     {
         Id = dto.Id,
         OddName = $"{dto.HomeTeamName} vs {dto.AwayTeamName}",
         HomeTeamName = dto.HomeTeamName,
         AwayTeamName = dto.AwayTeamName,
         OddValues = new OddValue()
         {
             Id = dto.OddValues.Id,
             HomeOddValue = dto.OddValues.HomeOddValue,
             DrawOddValue = dto.OddValues.DrawOddValue,
             AwayOddValue = dto.OddValues.AwayOddValue,
         }
     });
 }
Ejemplo n.º 4
0
        public async Task Create_Post_RedirectsToIndex()
        {
            var odds = new OddDto()
            {
                HomeTeamName = "Test1",
                AwayTeamName = "Test2",
                OddName      = "TestName",
                OddValues    = new OddValueDto()
                {
                    HomeOddValue = new decimal(1.35),
                    AwayOddValue = new decimal(3.10),
                    DrawOddValue = new decimal(1.01)
                },
            };

            this._oddsService.AddAsync(odds).Returns(odds);

            var result = await sut.Create(OddsMapper.InverseMap(odds));

            var routeResult = result as RedirectToActionResult;

            Assert.NotNull(result, "Not a redirect result");
            Assert.AreEqual(routeResult.ActionName, "Index");
        }
Ejemplo n.º 5
0
        public async Task <OddDto> DeleteAsync(OddDto dto)
        {
            await DeleteAsync(dto.Id);

            return(dto);
        }
Ejemplo n.º 6
0
 public async Task <OddDto> AddAsync(OddDto dto)
 {
     return(Map(await _oddsRepository.AddAsync(InverseMap(dto))));
 }
Ejemplo n.º 7
0
 private ExternalOddMessage Convert(OddDto odd)
 {
     return(new ExternalOddMessage(_provider, odd.EventId, odd.MarketKind, Convert(odd.Outcomes)));
 }