public TeamPlayerLineup(ITeamPlayerLineup teamPlayerLineup) { if (teamPlayerLineup != null) { TeamId = teamPlayerLineup.TeamId; PlayerId = teamPlayerLineup.PlayerId; BattingOrder = teamPlayerLineup.BattingOrder; } }
public ChangeResult Save(ITeamPlayerLineup teamPlayerLineup) { bool isAdd = GetTeamPlayerLineupItem(teamPlayerLineup.TeamId, teamPlayerLineup.PlayerId) == null; if (isAdd) { return(AddNew(teamPlayerLineup)); } else { return(Update(teamPlayerLineup)); } }
public ITeamPlayerLineup GetTeamPlayerLineupItem(Guid teamId, Guid playerId) { ITeamPlayerLineup teamPlayerLineup = null; using (var context = new Data.DartballContext()) { var item = context.TeamPlayerLineups.FirstOrDefault(x => x.TeamId == teamId.ToString() && x.PlayerId == playerId.ToString()); if (item != null) { teamPlayerLineup = Mapper.Map <TeamPlayerLineupDto>(item); } } return(teamPlayerLineup); }
public ChangeResult Update(ITeamPlayerLineup teamPlayerLineup) { return(Update(new List <ITeamPlayerLineup> { teamPlayerLineup })); }
public ChangeResult AddNew(ITeamPlayerLineup teamPlayerLineup) { return(AddNew(new List <ITeamPlayerLineup> { teamPlayerLineup })); }