internal DevTest GetById(int id) { using (var _dbContext = new SignalRContext()) { return(_dbContext.DevTests.FirstOrDefault(p => p.Id == id)); } }
//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); }
internal IEnumerable <DevTest> Get() { using (var _dbContext = new SignalRContext()) { return(_dbContext.DevTests.ToList()); } }
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); }
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); }
public MessageRepository(SignalRContext context) : base(context) { }
public UnitOfWork(SignalRContext context) { Context = context; Messages = new MessageRepository(Context); ApplicationUsers = new ApplicationUserRepository(Context); }
public Repository(SignalRContext context) { Context = context; }
public ApplicationUserRepository(SignalRContext context) : base(context) { }
public UnitOfWork() { _db = new SignalRContext(); }
public UserRepository(SignalRContext dbContext) { _dbContext = dbContext; }
public HomeController(ILogger <HomeController> logger, SignalRContext context, UserManager <ApplicationUser> userManager) { _logger = logger; _userManager = userManager; work = new UnitOfWork(context); }
public dynamic GetResults() { SignalRContext context = new SignalRContext(); return(context.ConnectionMapping.ToList()); }