Esempio n. 1
0
 public Topic getTopic(string subject, string topic)
 {
     using (var db = new MedTrainDBContext())
     {
         return(db.Topics.Find(topic, subject));
     }
 }
Esempio n. 2
0
 public List <Subject> getSubjects()
 {
     using (var db = new MedTrainDBContext())
     {
         return(db.Subjects.ToList());
     }
 }
Esempio n. 3
0
 public Answer getAnswer(int answerId)
 {
     using (var db = new MedTrainDBContext())
     {
         return(db.Answers.Find(answerId));
     }
 }
Esempio n. 4
0
 public Admin getAdmin(string UserId)
 {
     using (var db = new MedTrainDBContext())
     {
         return(db.Admins.Find(UserId));
     }
 }
Esempio n. 5
0
 public Subject getSubject(string subject)
 {
     using (var db = new MedTrainDBContext())
     {
         return(db.Subjects.Find(subject));
     }
 }
Esempio n. 6
0
 public void removeGroupMember(GroupMember gm)
 {
     using (var db = new MedTrainDBContext())
     {
         db.GroupsMembers.Remove(gm);
     }
 }
Esempio n. 7
0
 public Test getTest(int TestId)
 {
     using (var db = new MedTrainDBContext())
     {
         return(db.Tests.Find(TestId));
     }
 }
Esempio n. 8
0
 public Group getGroup(string adminId, string groupName)
 {
     using (var db = new MedTrainDBContext())
     {
         return(db.Groups.Find(adminId, groupName));
     }
 }
Esempio n. 9
0
 public UserLevel getUserLevel(string eMail, string subject, string topic)
 {
     using (var db = new MedTrainDBContext())
     {
         return(db.UsersLevels.Find(eMail, topic, subject));
     }
 }
Esempio n. 10
0
 public List <Question> getQuestions(string subject, string topic)
 {
     using (var db = new MedTrainDBContext())
     {
         if (getTopic(subject, topic) == null)
         {
             return(new List <Question>());
         }
         var query = from q in db.Questions
                     where q.SubjectId.Equals(subject) && !q.isDeleted
                     select q;
         List <Question> ans = new List <Question>();
         foreach (Question q in query)
         {
             var diagnoses = from d in db.Diagnoses
                             where d.QuestionId == q.QuestionId
                             select d;
             foreach (Diagnosis d in diagnoses)
             {
                 if (d.TopicId.Equals(topic))
                 {
                     ans.Add(q);
                     break;
                 }
             }
         }
         return(ans);
     }
 }
Esempio n. 11
0
 public Question getQuestion(int id)
 {
     using (var db = new MedTrainDBContext())
     {
         return(db.Questions.Find(id));
     }
 }
Esempio n. 12
0
 public void updateGroupMember(GroupMember gm)
 {
     using (var db = new MedTrainDBContext())
     {
         db.Entry(gm).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Esempio n. 13
0
 public void updateUserLevel(UserLevel ul)
 {
     using (var db = new MedTrainDBContext())
     {
         db.Entry(ul).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Esempio n. 14
0
 public void updateQuestion(Question q)
 {
     using (var db = new MedTrainDBContext())
     {
         db.Entry(q).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Esempio n. 15
0
 public void removeGroup(Group g)
 {
     using (var db = new MedTrainDBContext())
     {
         Group group = db.Groups.Find(g.AdminId, g.name);
         db.Groups.Remove(group);
         db.SaveChanges();
     }
 }
Esempio n. 16
0
 public List <GroupMember> getUserInvitations(string userId)
 {
     using (var db = new MedTrainDBContext())
     {
         var query = from gm in db.GroupsMembers
                     where gm.UserId.Equals(userId) && !gm.invitationAccepted
                     select gm;
         return(query.ToList());
     }
 }
Esempio n. 17
0
 public List <GroupMember> getGroupMembers(string groupName, string adminId)
 {
     using (var db = new MedTrainDBContext())
     {
         var query = from gm in db.GroupsMembers
                     where gm.GroupName.Equals(groupName) && gm.AdminId.Equals(adminId) && gm.invitationAccepted
                     select gm;
         return(query.ToList());
     }
 }
Esempio n. 18
0
 public List <Diagnosis> getQuestionDiagnoses(int qId)
 {
     using (var db = new MedTrainDBContext())
     {
         var query = from d in db.Diagnoses
                     where d.QuestionId == qId
                     select d;
         return(query.ToList());
     }
 }
Esempio n. 19
0
 public List <QuestionImage> getQuestionImages(int qId)
 {
     using (var db = new MedTrainDBContext())
     {
         var query = from i in db.Images
                     where i.QuestionId == qId
                     select i;
         return(query.ToList());
     }
 }
Esempio n. 20
0
 public List <Topic> getTopics(string subject)
 {
     using (var db = new MedTrainDBContext())
     {
         var query = from t in db.Topics
                     where t.SubjectId.Equals(subject)
                     select t;
         return(query.ToList());
     }
 }
Esempio n. 21
0
 public User getUser(string UserId)
 {
     using (var db = new MedTrainDBContext())
     {
         var query = from u in db.Users
                     where u.UserId.Equals(UserId)
                     select u;
         return(query.Count() == 1 ? query.ToList()[0] : null);
     }
 }
Esempio n. 22
0
 public List <TestQuestion> getTestQuestions(int TestId)
 {
     using (var db = new MedTrainDBContext())
     {
         var query = from tq in db.TestsQuestions
                     where tq.TestId == TestId
                     select tq;
         return(query.ToList());
     }
 }
Esempio n. 23
0
 public List <Group> getAdminsGroups(string adminId)
 {
     using (var db = new MedTrainDBContext())
     {
         var query = from g in db.Groups
                     where g.AdminId.Equals(adminId)
                     select g;
         return(query.ToList());
     }
 }
Esempio n. 24
0
 public List <GroupTest> getGroupTests(string groupName, string adminId)
 {
     using (var db = new MedTrainDBContext())
     {
         var query = from gt in db.GroupsTests
                     where gt.GroupName.Equals(groupName) && gt.AdminId.Equals(adminId)
                     select gt;
         return(query.ToList());
     }
 }
Esempio n. 25
0
 public List <Test> getAllTests(string subject)
 {
     using (var db = new MedTrainDBContext())
     {
         var query = from t in db.Tests
                     where t.subject.Equals(subject)
                     select t;
         return(query.ToList());
     }
 }
Esempio n. 26
0
 public List <GroupTestAnswer> getGroupTestAnswers(string groupName, string adminId, int TestId)
 {
     using (var db = new MedTrainDBContext())
     {
         var query = from gta in db.GroupsTestsAnswers
                     where gta.GroupName.Equals(groupName) && gta.AdminId.Equals(adminId) &&
                     gta.TestId == TestId
                     select gta;
         return(query.ToList());
     }
 }
Esempio n. 27
0
 public bool hasInvitation(string userId, string groupName, string adminId)
 {
     using (var db = new MedTrainDBContext())
     {
         var query = from gm in db.GroupsMembers
                     where gm.UserId.Equals(userId) && gm.GroupName.Equals(groupName) &&
                     gm.AdminId.Equals(adminId) && !gm.invitationAccepted
                     select gm;
         return(query.Count() == 1);
     }
 }
Esempio n. 28
0
 public void addUser(User u)
 {
     using (var db = new MedTrainDBContext())
     {
         if (db.Users.Find(u.UserId) != null)
         {
             return;
         }
         db.Users.Add(u);
         db.SaveChanges();
     }
 }
Esempio n. 29
0
 public void addGroupMember(GroupMember gm)
 {
     using (var db = new MedTrainDBContext())
     {
         if (db.Groups.Find(gm.AdminId, gm.GroupName) == null || db.GroupsMembers.Find(gm.GroupName, gm.AdminId, gm.UserId) != null)
         {
             return;
         }
         db.GroupsMembers.Add(gm);
         db.SaveChanges();
     }
 }
Esempio n. 30
0
 public void addTest(Test t)
 {
     using (var db = new MedTrainDBContext())
     {
         if (db.Admins.Find(t.AdminId) == null || db.Subjects.Find(t.subject) == null || db.Tests.Find(t.TestId) != null)
         {
             return;
         }
         db.Tests.Add(t);
         db.SaveChanges();
     }
 }