public async Task <OddDto> UpdateAsync(OddDto dto) { var entity = InverseMap(dto); await _oddsRepository.UpdateAsync(entity); await _oddsRepository.UpdateAsync(entity.OddValues); return(Map(entity)); }
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, } }); }
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, } }); }
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"); }
public async Task <OddDto> DeleteAsync(OddDto dto) { await DeleteAsync(dto.Id); return(dto); }
public async Task <OddDto> AddAsync(OddDto dto) { return(Map(await _oddsRepository.AddAsync(InverseMap(dto)))); }
private ExternalOddMessage Convert(OddDto odd) { return(new ExternalOddMessage(_provider, odd.EventId, odd.MarketKind, Convert(odd.Outcomes))); }