Example #1
0
 internal DevTest GetById(int id)
 {
     using (var _dbContext = new SignalRContext())
     {
         return(_dbContext.DevTests.FirstOrDefault(p => p.Id == id));
     }
 }
Example #2
0
 //Add or Edit DevTest
 internal bool Submit(DevTest objDevtest)
 {
     if (objDevtest.Id > 0) //Edit
     {
         DevTest devTestModel;
         using (var _dbContext = new SignalRContext())
         {
             devTestModel = _dbContext.DevTests.FirstOrDefault(p => p.Id == objDevtest.Id);
             if (devTestModel == null)
             {
                 return(false);
             }
         }
         using (var _dbContext = new SignalRContext())
         {
             _dbContext.Entry(objDevtest).State = System.Data.Entity.EntityState.Modified;
             if (_dbContext.SaveChanges() > 0)
             {
                 return(true);
             }
         }
     }
     else //Add
     {
         using (var _dbContext = new SignalRContext())
         {
             _dbContext.DevTests.Add(objDevtest);
             if (_dbContext.SaveChanges() > 0)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Example #3
0
 internal IEnumerable <DevTest> Get()
 {
     using (var _dbContext = new SignalRContext())
     {
         return(_dbContext.DevTests.ToList());
     }
 }
Example #4
0
 internal bool DeleteById(int id)
 {
     using (var _dbContext = new SignalRContext())
     {
         var devtestModel = _dbContext.DevTests.FirstOrDefault(p => p.Id == id);
         if (devtestModel != null)
         {
             _dbContext.DevTests.Remove(devtestModel);
             if (_dbContext.SaveChanges() > 0)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Example #5
0
        private UserDto InitPlayer(string playerConnectionId, MatchDto matchDto, ValilGame valilGame)
        {
            string playerSessionId = SignalRContext.GetSessionIdByConnectionId(playerConnectionId);
            string playerUsername  = SignalRContext.StorageProvider.Current[playerSessionId] as string;

            UserDto player = _getUserByUserNameQueryHandler.Handle(new GetUserByUserNameQuery(playerUsername));

            player.ConnectionId = playerConnectionId;
            player.SessionId    = playerSessionId;

            SignalRContext.SessionProvider[player.SessionId][NamingContract.Session_SearchingForMatch] = false;
            SignalRContext.SessionProvider[player.SessionId][NamingContract.Session_Match]             = matchDto;
            SignalRContext.SessionProvider[player.SessionId][NamingContract.Session_Game] = valilGame;

            _gameHub.Groups.Add(player.ConnectionId, matchDto.MatchId).Wait();

            return(player);
        }
Example #6
0
 public MessageRepository(SignalRContext context) : base(context)
 {
 }
Example #7
0
 public UnitOfWork(SignalRContext context)
 {
     Context          = context;
     Messages         = new MessageRepository(Context);
     ApplicationUsers = new ApplicationUserRepository(Context);
 }
Example #8
0
 public Repository(SignalRContext context)
 {
     Context = context;
 }
Example #9
0
 public ApplicationUserRepository(SignalRContext context) : base(context)
 {
 }
 public UnitOfWork()
 {
     _db = new SignalRContext();
 }
 public UserRepository(SignalRContext dbContext)
 {
     _dbContext = dbContext;
 }
Example #12
0
 public HomeController(ILogger <HomeController> logger, SignalRContext context, UserManager <ApplicationUser> userManager)
 {
     _logger      = logger;
     _userManager = userManager;
     work         = new UnitOfWork(context);
 }
Example #13
0
        public dynamic GetResults()
        {
            SignalRContext context = new SignalRContext();

            return(context.ConnectionMapping.ToList());
        }