Exemple #1
0
        public async Task <PlayerHistoryEntity> GetByIDAsync(int playerHistoryID)
        {
            List <PlayerHistoryEntity> historyEntities = await GetAsync();

            PlayerHistoryEntity historyEntity = historyEntities?.SingleOrDefault(h => h.PlayerHistoryID == playerHistoryID);

            return(historyEntity);
        }
Exemple #2
0
        public async Task UpdatePlayerHistory(PlayerHistoryBE historyBE)
        {
            PlayerHistoryEntity historyEntity = base.Mapper.Map <PlayerHistoryEntity>(historyBE);

            historyEntity.LastModifiedBy       = SystemConstants.DefaultUser;
            historyEntity.LastModifiedDateTime = DateTime.UtcNow;

            await base.DataSvc.PlayerHistoryRepo.UpdateAsync(historyEntity);
        }
Exemple #3
0
        public async Task <bool> InsertAsync(PlayerHistoryEntity entity)
        {
            PlayerHistoryEntity lastHistory = (await GetAsync())?.OrderByDescending(h => h.PlayerHistoryID)?.FirstOrDefault();

            entity.PlayerHistoryID = (lastHistory?.PlayerHistoryID ?? 0) + 1;
            bool response = await base.InsertAsync(entity);

            return(response);
        }
Exemple #4
0
        public async Task <PlayerHistoryBE> GetPlayerHistory(int playerHistoryID)
        {
            PlayerHistoryEntity historyEntity = await base.DataSvc.PlayerHistoryRepo.GetByIDAsync(playerHistoryID);

            PlayerHistoryBE historyBE = historyEntity != null
                ? base.Mapper.Map <PlayerHistoryBE>(historyEntity)
                : null;

            return(historyBE);
        }
Exemple #5
0
        public async Task InsertNewHistory(PlayerHistoryBE historyBE)
        {
            PlayerHistoryEntity historyEntity = base.Mapper.Map <PlayerHistoryEntity>(historyBE);

            historyEntity.CreatedBy       = historyEntity.LastModifiedBy = SystemConstants.DefaultUser;
            historyEntity.CreatedDateTime = historyEntity.LastModifiedDateTime = DateTime.UtcNow;

            await base.DataSvc.PlayerHistoryRepo.InsertAsync(historyEntity);

            historyBE.PlayerHistoryID = historyEntity.PlayerHistoryID;
        }
Exemple #6
0
        public async Task <bool> UpdateAsync(PlayerHistoryEntity entity)
        {
            List <PlayerHistoryEntity> histories = await GetAsync();

            PlayerHistoryEntity history = histories.SingleOrDefault(h => h.PlayerHistoryID == entity.PlayerHistoryID);

            //PlayerHistoryEntity fields that support manipulation
            history.CompletedDateTime    = entity.CompletedDateTime;
            history.LastModifiedBy       = entity.LastModifiedBy;
            history.LastModifiedDateTime = entity.LastModifiedDateTime;

            bool response = await base.UpdateAsync(histories);

            return(response);
        }