Beispiel #1
0
        private CreatePlayedGameViewModel FillCreatePlayedGameViewModel(ApplicationUser currentUser, CreatePlayedGameViewModel viewModel)
        {
            var mostPlayedGames =
                _gameDefinitionRetriever.GetMostPlayedGames(new GetMostPlayedGamesQuery
            {
                GamingGroupId = currentUser.CurrentGamingGroupId.Value,
                Page          = 1,
                PageSize      = 5
            });
            var recentPlayedGames =
                _gameDefinitionRetriever.GetRecentGames(new GetRecentPlayedGamesQuery
            {
                GamingGroupId = currentUser.CurrentGamingGroupId.Value,
                Page          = 1,
                PageSize      = 5
            });

            var players = _playerRetriever.GetPlayersToCreate(currentUser.Id, currentUser.CurrentGamingGroupId.Value);

            viewModel.UserPlayer        = players.UserPlayer;
            viewModel.OtherPlayers      = players.OtherPlayers;
            viewModel.RecentPlayers     = players.RecentPlayers;
            viewModel.RecentPlayedGames = _mapperFactory.GetMapper <GameDefinitionDisplayInfo, GameDefinitionDisplayInfoViewModel>()
                                          .Map(recentPlayedGames)
                                          .ToList();
            viewModel.MostPlayedGames = _mapperFactory.GetMapper <GameDefinitionDisplayInfo, GameDefinitionDisplayInfoViewModel>()
                                        .Map(mostPlayedGames)
                                        .ToList();
            return(viewModel);
        }
Beispiel #2
0
        public async Task <IActionResult> Modified(string idOrCode, ModifiedInfoUserModel user)
        {
            if (string.IsNullOrEmpty(idOrCode) || string.IsNullOrWhiteSpace(idOrCode))
            {
                return(BadRequest());
            }

            try
            {
                var mapper     = _factory.GetMapper <UserProfile>();
                var userEntity = mapper.Map <ModifiedInfoUserModel, User>(user);
                userEntity.Code     = idOrCode;
                userEntity.Password = EncryptService.Encrypt(user.Password);

                var data = await _userService.UpdateAsync(userEntity);

                return(Json(data));
            }
            catch (ExceptionError e)
            {
                if (e.Error.ErrorCode.Equals((int)ErrorCodeEnum.FailData))
                {
                    Log.Error(e.Error.Data);
                    throw;
                }
                else
                {
                    return(NotFound());
                }
            }
        }
        public T GetConfigData <X, T>(ConfigFile <X, T> config, string pathOverride = null)
            where X : class
            where T : class
        {
            var path       = pathOverride ?? $@"{_userSettingsService.Get().GameInstallLocation}\{config.GamePath}";
            var xml        = _fileStorageService.Get(path).Value;
            var xmlclasses = _serializationService.Deserialize <X>(xml);

            return(_mapperFactory.GetMapper(config).Convert(xmlclasses.Value));
        }
Beispiel #4
0
        public virtual ActionResult Index(ApplicationUser currentUser)
        {
            var achievements = AchievementFactory.GetAchievements();
            var model        = new AchievementListViewModel
            {
                CurrentUserId = currentUser?.Id,
                Achievements  = achievements.Select(a => _mapperFactory.GetMapper <IAchievement, AchievementViewModel>().Map(a)).OrderByDescending(a => a.Winners.Count).ThenBy(a => a.Name).ToList()
            };

            return(View(MVC.Achievement.Views.Index, model));
        }
Beispiel #5
0
        public List <ArticleGroupByDateResponseModel> GetArticleGroupBySection(SectionType sectionType)
        {
            sectionType.ThrowIfDefault(nameof(sectionType));

            var articlesResult = _webProvider.GetArticlesNyt(sectionType);

            if (articlesResult == null || articlesResult.results?.Count == 0)
            {
                throw new System.Exception("Nothing has been returned.");
            }

            return(_mapperFactory.GetMapper <ArticlesNYT, ArticleGroupByDateResponseModel>().Map(articlesResult));
        }
Beispiel #6
0
        public virtual ActionResult Index()
        {
            var recentPlayerAchievements = _recentPlayerAchievementsUnlockedRetreiver.GetResults(new GetRecentPlayerAchievementsUnlockedQuery {
                PageSize = NUMBER_OF_RECENT_ACHIEVEMENTS_TO_SHOW
            });
            var recentPlayerAchievementsViewModel =
                recentPlayerAchievements.ToMappedPagedList(_mapperFactory.GetMapper <PlayerAchievement, PlayerAchievementWinnerViewModel>());

            var recentlyPlayedGamesFilter = new RecentlyPlayedGamesFilter
            {
                NumberOfGamesToRetrieve = NUMBER_OF_RECENT_PUBLIC_GAMES_TO_SHOW
            };
            var publicGameSummaries = _recentPublicGamesRetriever.GetResults(recentlyPlayedGamesFilter);

            var topGamingGroups = _topGamingGroupsRetriever.GetResults(NUMBER_OF_TOP_GAMING_GROUPS_TO_SHOW);

            var topGamingGroupViewModels = topGamingGroups.Select(_transformer.Transform <TopGamingGroupSummaryViewModel>).ToList();

            var trendingGamesRequest   = new TrendingGamesRequest(NUMBER_OF_TRENDING_GAMES_TO_SHOW, NUMBER_OF_DAYS_OF_TRENDING_GAMES);
            var trendingGames          = _trendingGamesRetriever.GetResults(trendingGamesRequest);
            var trendingGameViewModels = trendingGames.Select(_transformer.Transform <TrendingGameViewModel>).ToList();

            var homeIndexViewModel = new HomeIndexViewModel()
            {
                RecentAchievementsUnlocked = recentPlayerAchievementsViewModel,
                RecentPublicGames          = publicGameSummaries,
                TopGamingGroups            = topGamingGroupViewModels,
                TrendingGames = trendingGameViewModels
            };

            ViewBag.NumTrendingGameDays = NUMBER_OF_DAYS_OF_TRENDING_GAMES;
            return(View(MVC.Home.Views.Index, homeIndexViewModel));
        }
 public RepositoryService(IDbService dbService, IMapperFactory mapperFactory, BlazorContext dbContext)
 {
     _mapper    = mapperFactory.GetMapper("DAL");
     _dbService = dbService;
     _dbContext = dbContext;
     _objectSet = GetObjectSet <T>();
 }
Beispiel #8
0
 public QuestionsSetService(IUnitOfWorkFactory pUnitOfWorkFactory,
                            IMapperFactory pMapperFactory,
                            IQuestionsSetImporterFactory pQuestionsSetImporterFactory)
 {
     this._unitOfWorkFactory           = pUnitOfWorkFactory;
     this._mapper                      = pMapperFactory.GetMapper();
     this._questionsSetImporterFactory = pQuestionsSetImporterFactory;
 }
Beispiel #9
0
 public UtilitiesController(
     IUtilityService utilityService,
     IMapperFactory mapperFactory
     )
 {
     _utilityService = utilityService;
     _mapper         = mapperFactory.GetMapper(typeof(WebServices).Name);
 }
Beispiel #10
0
 public UtilityService(
     IUtilityRepository utilityRepository,
     IMapperFactory mapperFactory
     )
 {
     _utilityRepository = utilityRepository;
     _mapper            = mapperFactory.GetMapper(typeof(BLServices).Name);
 }
Beispiel #11
0
 public DefinedDatasetService(IUnitOfWork unit, IDefinedDatasetRepository definedDatasetRepository,
                              IDatasetRepository datasetRepository, IFieldTypeRepository feFieldTypeRepository, IMapperFactory mapperFactory)
 {
     _uow = unit;
     _definedDatasetRepository = definedDatasetRepository;
     _datasetRepository        = datasetRepository;
     _fieldTypeRepository      = feFieldTypeRepository;
     _mapper = mapperFactory.GetMapper(typeof(CoreServices).Name);
 }
Beispiel #12
0
 public ConstraintsService(IUnitOfWork unit, IConstraintsRepository constraintsRepository, IMapperFactory mapperFactory,
                           IFieldTypesConstraintsRepository fieldTypesConstraintsRepository, IFieldTypeRepository fieldTypeRepository)
 {
     _constraintsRepository           = constraintsRepository;
     _fieldTypesConstraintsRepository = fieldTypesConstraintsRepository;
     _fieldTypeRepository             = fieldTypeRepository;
     _uow    = unit;
     _mapper = mapperFactory.GetMapper(typeof(CoreServices).Name);
 }
 public CustomDatasetService(IUnitOfWork unit, ICustomDatasetRepository customDatasetRepository,
                             IDatasetRepository datasetRepository, IFieldTypeRepository typesRepository, IMapperFactory mapperFactory)
 {
     _uow = unit;
     _customDatasetRepository = customDatasetRepository;
     _datasetRepository       = datasetRepository;
     _typesRepository         = typesRepository;
     _mapper = mapperFactory.GetMapper(typeof(CoreServices).Name);
 }
Beispiel #14
0
 public AccountService(
     IUsersRepository repository,
     ISecurityHelper securityHelper,
     IMapperFactory mapperFactory
     )
 {
     _repository      = repository;
     _securityService = securityHelper;
     _mapper          = mapperFactory.GetMapper(typeof(BLServices).Name);
 }
 public OperativeServices(IMapperFactory pMapperFactory,
                          ISessionService pSessionService,
                          IQuestionsSetService pQuestionsSetService,
                          IUserService pUserService)
 {
     this._mapper              = pMapperFactory.GetMapper();
     this._sessionService      = pSessionService;
     this._questionsSetService = pQuestionsSetService;
     this._userService         = pUserService;
 }
        public SessionService(IUnitOfWorkFactory pUnitOfWorkFactory,
                              IMapperFactory pMapperFactory)
        {
            this.MIN_SESSION_QUESTIONS_QUANTITY = int.Parse(ConfigurationManager.AppSettings["MinSessionQuestionsQuantity"] ?? "10");

            this._unitOfWorkFactory = pUnitOfWorkFactory;
            this._mapper            = pMapperFactory.GetMapper();

            // Initialize Score Calculators
            this._scoreCalculators.Add(QuestionsSetsName.OpenTriviaDB.ToUpper(), new OpenTriviaDBScoreCalculator());
        }
Beispiel #17
0
        public ClaimFlightApiModel Map(ClaimFlight claimFlight)
        {
            EnsureArg.IsNotNull(claimFlight, nameof(claimFlight));
            var claimFlightMapper = mapperFactory.GetMapper <Claim, ClaimApiModel>();

            var claimFlightApiModel = (ClaimFlightApiModel)claimFlightMapper.Map(claimFlight);

            claimFlightApiModel.FlightDelayReasonId = claimFlight.FlightDelayReasonId;
            claimFlightApiModel.FlightNumber        = claimFlight.FlightNumber;

            return(claimFlightApiModel);
        }
Beispiel #18
0
        internal virtual T MakeBaseCreatePlayedGameViewModel <T>(int currentGamingGroupId) where T : CreatePlayedGameViewModel, new()
        {
            var mostPlayedGames =
                _gameDefinitionRetriever.GetMostPlayedGames(new GetMostPlayedGamesQuery
            {
                GamingGroupId = currentGamingGroupId,
                Page          = 1,
                PageSize      = 5
            });
            var recentPlayedGames =
                _gameDefinitionRetriever.GetRecentGames(new GetRecentPlayedGamesQuery
            {
                GamingGroupId = currentGamingGroupId,
                Page          = 1,
                PageSize      = 5
            });

            var recentPlayedGamesViewModels = _mapperFactory.GetMapper <GameDefinitionDisplayInfo, GameDefinitionDisplayInfoViewModel>()
                                              .Map(recentPlayedGames)
                                              .ToList();
            var mostPlayedGamesViewModels = _mapperFactory.GetMapper <GameDefinitionDisplayInfo, GameDefinitionDisplayInfoViewModel>()
                                            .Map(mostPlayedGames)
                                            .ToList();

            return(new T
            {
                RecentPlayedGames = recentPlayedGamesViewModels,
                MostPlayedGames = mostPlayedGamesViewModels
            });
        }
Beispiel #19
0
 public ChatService(
     IAccountService accountService,
     IChatRepository chatRepository,
     IMapperFactory mapperFactory,
     IChatHelper chatHelper,
     IEventService eventService)
 {
     _accountService = accountService;
     _chatRepository = chatRepository;
     _chatHelper     = chatHelper;
     _eventService   = eventService;
     _mapper         = mapperFactory.GetMapper(typeof(BLServices).Name);;
 }
 public EventsController(
     IEventService service,
     IMapperFactory mapperFactory,
     IImageSettings eventImageSettings,
     IAccountService accountService,
     IUtilityService utilityService
     )
 {
     _service            = service;
     _accountService     = accountService;
     _eventImageSettings = eventImageSettings;
     _utilityService     = utilityService;
     _mapper             = mapperFactory.GetMapper(typeof(WebServices).Name);
 }
Beispiel #21
0
 public AccountsController(
     IAccountService accountService,
     IMapperFactory mapperFactory,
     IJwtService jwtService,
     IEmailService emailService,
     IJwtSettings jwtSettings
     )
 {
     _accountService = accountService;
     _jwtService     = jwtService;
     _mapper         = mapperFactory.GetMapper(typeof(WebServices).Name);
     _emailService   = emailService;
     _jwtSettings    = jwtSettings;
 }
        public PlayerDetailsViewModel Build(PlayerDetails playerDetails, string urlForMinionBragging, ApplicationUser currentUser = null)
        {
            Validate(playerDetails);

            var playerDetailsViewModel = new PlayerDetailsViewModel
            {
                PlayerId             = playerDetails.Id,
                PlayerName           = playerDetails.Name,
                PlayerRegistered     = playerDetails.ApplicationUserId != null,
                Active               = playerDetails.Active,
                GamingGroupName      = playerDetails.GamingGroupName,
                GamingGroupId        = playerDetails.GamingGroupId,
                TotalGamesPlayed     = playerDetails.PlayerStats.TotalGames,
                NemePointsSummary    = new NemePointsSummaryViewModel(playerDetails.NemePointsSummary),
                TotalGamesWon        = playerDetails.PlayerStats.TotalGamesWon,
                TotalGamesLost       = playerDetails.PlayerStats.TotalGamesLost,
                WinPercentage        = playerDetails.PlayerStats.WinPercentage,
                TotalChampionedGames = playerDetails.ChampionedGames.Count,
                LongestWinningStreak = playerDetails.LongestWinningStreak,
                PlayerAchievements   = playerDetails.Achievements?.Select(pa => _mapperFactory.GetMapper <PlayerAchievement, PlayerAchievementSummaryViewModel>().Map(pa)).OrderByDescending(a => a.AchievementLevel).ThenByDescending(a => a.LastUpdatedDate).ToList() ?? new List <PlayerAchievementSummaryViewModel>()
            };

            PopulatePlayerVersusPlayersViewModel(playerDetails, playerDetailsViewModel);

            SetTwitterBraggingUrlIfThePlayerIsTheCurrentlyLoggedInUser(playerDetails, urlForMinionBragging, currentUser, playerDetailsViewModel);

            SetAveragePointsPerGame(playerDetails, playerDetailsViewModel);
            playerDetailsViewModel.AveragePlayersPerGame = playerDetails.PlayerStats.AveragePlayersPerGame;
            SetAveragePointsPerPlayer(playerDetails, playerDetailsViewModel);
            SetUserCanEditFlag(playerDetails, currentUser, playerDetailsViewModel);

            PopulatePlayerGameResults(playerDetails, playerDetailsViewModel);

            PopulateNemesisData(playerDetails.CurrentNemesis, playerDetailsViewModel);

            playerDetailsViewModel.Minions = (from Player player in playerDetails.Minions
                                              select _minionViewModelBuilder.Build(player)).ToList();

            playerDetailsViewModel.PlayerGameSummaries = playerDetails.PlayerGameSummaries.Select(Mapper.Map <PlayerGameSummaryViewModel>).ToList();

            SetChampionedGames(playerDetails, playerDetailsViewModel);

            SetFormerChampionedGames(playerDetails, playerDetailsViewModel);

            return(playerDetailsViewModel);
        }
Beispiel #23
0
        public IngresoMapeo(IGenericRepository repository, IMapperFactory mapperFactory) : base(repository)
        {
            DestinoDto(c => c.Fecha).Funcion(c => c.Documento.Fecha);
            DestinoDto(c => c.Numero).Funcion(c => c.Documento.Numero);
            DestinoDto(c => c.Serie).Funcion(c => c.Documento.Serie);
            DestinoDto(c => c.IdTipoDocumento).Funcion(c => c.Documento.Tipo.Id.Cadena());

            DestinoEntity(c => c.Documento).Funcion(c => new Documento
            {
                Fecha  = c.Fecha,
                Numero = c.Numero,
                Serie  = c.Serie,
                Tipo   = repository.Get <TipoDocumento>(c.IdTipoDocumento.Guid())
            });
            DestinoEntity(c => c.Fecha).Constante(DateTime.Today);
            DestinoEntityLista(c => c.Lineas).Funcion(c => c.Lineas).Mapper(mapperFactory.GetMapper <LineaIngresoAlmacen, LineaMovimiento>());
            AfterMakeEntity(m => m.Lineas.ForEach(l => l.Movimiento = m));
        }
Beispiel #24
0
 public UsersController(
     IAccountService accountService,
     IEventService eventService,
     IMapperFactory mapperFactory,
     IJwtService jwtService,
     IEmailService emailService,
     ILogger <AccountsController> logger,
     IImageSettings accountImageSettings,
     IUtilityService utilityService,
     IJwtSettings jwtSettings
     )
 {
     _accountService       = accountService;
     _eventService         = eventService;
     _jwtService           = jwtService;
     _mapper               = mapperFactory.GetMapper(typeof(WebServices).Name);
     _logger               = logger;
     _emailService         = emailService;
     _accountImageSettings = accountImageSettings;
     _utilityService       = utilityService;
     _jwtSettings          = jwtSettings;
 }
Beispiel #25
0
 public BaseBL(IRepositoryService <TDto, TEntity> repository, IMapperFactory mapperFactory, IBaseBL logger)
 {
     this._logger     = logger;
     this._mapper     = mapperFactory.GetMapper("BL");
     this._repository = repository;
 }
Beispiel #26
0
 public ChatHub(IMapperFactory mapperFactory, IChatService chatService)
 {
     _mapper      = mapperFactory.GetMapper(typeof(WebServices).Name);
     _chatService = chatService;
 }
Beispiel #27
0
 public GeneratedObjectsService(IMapperFactory factory, IGeneratedObjectsRepository generatedObjectsRepository)
 {
     _mapper = factory.GetMapper(typeof(CoreServices).Name);
     _generatedObjectsRepository = generatedObjectsRepository;
 }
Beispiel #28
0
 public RepositoryService(IDbService dbService, IMapperFactory mapperFactory)
 {
     _mapper    = mapperFactory.GetMapper("DAL");
     _dbService = dbService;
     _objectSet = GetObjectSet <T>();
 }
 public DatasetTypesService(IUnitOfWork unit, IMapperFactory mapperFactory, IDatasetTypesRepository datasetTypesRepository)
 {
     _uow    = unit;
     _mapper = mapperFactory.GetMapper(typeof(CoreServices).Name);
     _datasetTypesRepository = datasetTypesRepository;
 }
Beispiel #30
0
 public FieldsService(IMapperFactory mapperFactory, IUnitOfWork unitOfWork, IFieldRepository fieldRepository)
 {
     _mapper          = mapperFactory.GetMapper(typeof(CoreServices).Name);
     _unitOfWork      = unitOfWork;
     _fieldRepository = fieldRepository;
 }