/// <summary> /// Create /// </summary> /// <param name="date"></param> /// <param name="player1"></param> /// <param name="isPlayer1Visitor"></param> /// <param name="player2"></param> /// <param name="isPlayer2Visitor"></param> /// <param name="score"></param> /// <param name="sessionDescription"></param> /// <returns>Id of created record</returns> /// <exception cref="SeventyClubServiceException"></exception> public long Create( DateTime date, string player1, bool isPlayer1Visitor, string player2, bool isPlayer2Visitor, decimal score, string sessionDescription) { try { using (var data = new SeventyClubData()) { var dto = new SeventyPercentClubEntryDto( date: date, player1: player1, isPlayer1Visitor: isPlayer1Visitor, player2: player2, isPlayer2Visitor: isPlayer2Visitor, score: score, sessionDescription: sessionDescription); data.Create(dto); return(dto.Id); } } catch (Exception ex) { var seventyClubServiceException = new SeventyClubServiceException(ex); throw seventyClubServiceException; } }
public static SeventyPercentClubEntry MapToDomain(this SeventyPercentClubEntryDto dto) => ServiceMapper.Map <SeventyPercentClubEntry>(dto);
/// <summary> /// Create /// </summary> /// <param name="dto">70% Club Entry</param> /// <exception cref="DbUpdateException"></exception> /// <exception cref="DbUpdateConcurrencyException"></exception> public void Create(SeventyPercentClubEntryDto dto) { _context.SeventyPercentClubEntries.Add(dto); _context.SaveChanges(); }