Ejemplo n.º 1
0
        public void RevokeAnswer(int roomNumber, string answer)
        {
            var db = new AppDbContext();
            var room = FindRoom(roomNumber, db);

            var userID = Context.User.Identity.Name;
            ClearMyAnswers(db, room, userID);
            db.SaveChanges();

            UpdateTotaling(room);
        }
Ejemplo n.º 2
0
        public void Reset(int roomNumber)
        {
            var db = new AppDbContext();
            var room = FindRoom(roomNumber, db);
            room.Answers.ToList().ForEach(a =>
            {
                db.Answers.Remove(a);
            });
            db.SaveChanges();

            Clients.Group(roomNumber.ToString()).Reset();
        }
Ejemplo n.º 3
0
        public void PostAnswer(int roomNumber, string answer)
        {
            var db = new AppDbContext();
            var room = FindRoom(roomNumber, db);

            var userID = Context.User.Identity.Name;
            ClearMyAnswers(db, room, userID);

            room.Answers.Add(new Answer
            {
                AnsweredUserID = userID,
                ChosedOptionText = answer
            });
            db.SaveChanges();

            UpdateTotaling(room);
        }