private void AddGm(string gameMasterCode, OfferedGameDto offeredGameDto) { UserOnOfferedGameDto newMapping = new UserOnOfferedGameDto { OfferedGameId = offeredGameDto.Id, UserType = UserType.GameMaster, UserId = _userRepository.GetByCode(gameMasterCode).Id }; offeredGameDto.UserOnOfferedGame.Add(newMapping); }
private OfferedGameResult OfferedGameParse(OfferedGameDto offeredGameDto) { OfferedGameResult result = new OfferedGameResult { OfferedGameForm = new OfferedGameForm { Id = offeredGameDto.Id.ToString(), Description = offeredGameDto.Description, Duration = offeredGameDto.Duration.ToString(), MinSize = offeredGameDto.MinSize.ToString(), MaxSize = offeredGameDto.MinSize.ToString(), Title = offeredGameDto.Title, GameType = offeredGameDto.GameType } }; var offeredGameTempDto = _offeredGameRepository.GetById(offeredGameDto.Id); if (offeredGameTempDto.UserOnOfferedGame.Any()) { UserOnOfferedGameDto mapping = offeredGameTempDto.UserOnOfferedGame .FirstOrDefault(t => t.UserType == UserType.GameMaster); if (mapping != null && mapping.User != null) { result.OfferedGameForm.GameMasterCode = mapping.User.Code; } } if (offeredGameDto.Language != null) { result.OfferedGameForm.LanguageCode = offeredGameDto.Language.TwoDigitSeoCode; } if (offeredGameDto.OfferedGameOnTag.Any()) { result.OfferedGameForm.Tags = new Dictionary <string, string>(); foreach (var tag in offeredGameDto.OfferedGameOnTag) { result.OfferedGameForm.Tags.Add(_tagPrefix + tag.TagId, "on"); } } return(result); }