示例#1
0
        public virtual List <DbTipster> GetTipstersExceptDefault()
        {
            var me         = DbTipster.Me();
            var dbTipsters = _db.Tipsters.Include(t => t.Website.Login).Where(t => t.Id != me.Id).OrderBy(t => t.Name).ToList();

            //foreach (var t in dbTipsters)
            //    db.Entry(t.Website).Reference(e => e.Login).Load(); // zamiast explicitly loading tutaj, eager loading u góry, zostawione dla odniesienia

            return(dbTipsters);
        }
示例#2
0
        public virtual List <DbTipster> GetTipstersExceptDefaultById(params int[] ids)
        {
            if (!ids.Any())
            {
                return(new List <DbTipster>());
            }

            var me = DbTipster.Me();

            return(_db.Tipsters.Include(t => t.Website.Login).WhereByMany(t => t.Id, ids).Where(t => t.Id != me.Id).ToList());
        }
示例#3
0
        public virtual void EnsureDefaultTipsterExists()
        {
            var me = DbTipster.Me();

            if (_db.Tipsters.Any(t => t.Id == me.Id))
            {
                return;
            }

            _db.Tipsters.Add(me);
            _db.SaveChanges();
        }
示例#4
0
 public void UpsertMyBet(DbBet bet, bool addOnly = false)
 {
     UpsertBet(DbTipster.Me(), bet, addOnly);
 }
示例#5
0
 public void UpsertMyBets(List <DbBet> bets, bool addOnly = false)
 {
     UpsertBets(DbTipster.Me(), bets, addOnly);
 }