Exemplo n.º 1
0
 public static bool CheckIfTestCreated(int idPerson)
 {
     using (var db = new FriendTestEntities())
     {
         return(db.Test.Any(t => t.ID_Person == idPerson));
     }
 }
Exemplo n.º 2
0
 public static bool CheckIfTestPassed(int idPerson, int idCreator)
 {
     using (var db = new FriendTestEntities())
     {
         return(db.Result.Any(r => r.ID_PersonQuestioner == idCreator && r.ID_PersonRespondent == idPerson));
     }
 }
Exemplo n.º 3
0
 public static void RemoveQuestion(Question que)
 {
     using (var db = new FriendTestEntities())
     {
         int id      = que.ID;
         var answers = from ans in db.Answer
                       where ans.ID_question == id
                       select ans;
         foreach (Answer item in answers)
         {
             db.Answer.Remove(item);
         }
         db.SaveChanges();
         var quest = from q in db.Question
                     where q.ID == id
                     select q;
         foreach (Question q in quest)
         {
             db.Question.Remove(q);
         }
         db.SaveChanges();
     }
 }