Ejemplo n.º 1
0
 public List<Participant> participants()
 {
     var db = new Context();
     var ps = from s in db.Participants
              where s.competition_id == this.id
              orderby s.likes descending
              select s;
     return ps.ToList();
 }
Ejemplo n.º 2
0
 public bool participating(string username) 
 {
     var db = new Context();
     var ps = from s in db.Participants
              where s.competition_id == this.id
              where s.username == username
              select s;
     //throw new Exception(username);
     return ps.Count() > 0;
 }
Ejemplo n.º 3
0
        public void update_status() {
            DateTime now = DateTime.Now;

            if (status < 3 && now > end)
            {
                status = 3;
            }

            if (status == 0 && now > begin) 
            {
                status = 1;
            }

            var db = new Context();
            db.Entry(this).State = System.Data.EntityState.Modified;
            db.SaveChanges();
        }