public Picture GetPicture(int ID)
 {
     using (CAAContext context = new CAAContext())
     {
         var items = context.Pictures.Where(p => p.ID == ID).FirstOrDefault();
         return(items);
     }
 }
 public void AddPicture(Picture pictureToAdd)
 {
     using (CAAContext context = new CAAContext())
     {
         context.Pictures.Add(pictureToAdd);
         context.SaveChanges();
     }
 }
コード例 #3
0
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="itemToUpdate"></param>
 public void UpdateItem(Item itemToUpdate)
 {
     using (CAAContext context = new CAAContext())
     {
         context.Update(itemToUpdate);
         context.SaveChanges();
     }
 }
 public List <Picture> GetPictures()
 {
     using (CAAContext context = new CAAContext())
     {
         var items = context.Pictures.OrderByDescending(a => a.CreatedDate).ToList();
         return(items);
     }
 }
コード例 #5
0
 /// <summary>
 /// Add
 /// </summary>
 /// <param name="itemToAdd"></param>
 public void AddItem(Item itemToAdd)
 {
     using (CAAContext context = new CAAContext())
     {
         context.Items.Add(itemToAdd);
         context.SaveChanges();
     }
 }
コード例 #6
0
 /// <summary>
 /// Delete
 /// </summary>
 /// <param name="itemToDelete"></param>
 public void DeleteItem(Item itemToDelete)
 {
     using (CAAContext context = new CAAContext())
     {
         context.Items.Remove(itemToDelete);
         context.SaveChanges();
     }
 }
コード例 #7
0
 /// <summary>
 /// Permanent Delete (No Longer in Database)
 /// </summary>
 /// <param name="eventToDelete"></param>
 public void DeleteEventPermanent(Event eventToDelete)
 {
     using (CAAContext context = new CAAContext())
     {
         context.Events.Remove(eventToDelete);
         context.SaveChanges();
     }
 }
コード例 #8
0
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="eventToUpdate"></param>
 public void UpdateEvent(Event eventToUpdate)
 {
     using (CAAContext context = new CAAContext())
     {
         context.Update(eventToUpdate);
         context.SaveChanges();
     }
 }
コード例 #9
0
 /// <summary>
 /// Add
 /// </summary>
 /// <param name="eventToAdd"></param>
 public void AddEvent(Event eventToAdd)
 {
     using (CAAContext context = new CAAContext())
     {
         context.Events.Add(eventToAdd);
         context.SaveChanges();
     }
 }
コード例 #10
0
 public List <Game> SearchGame(string search)
 {
     using (CAAContext context = new CAAContext())
     {
         var question = context.Games
                        .Where(d => d.Title.ToUpper().Contains(search.ToUpper())).ToList();
         return(question);
     }
 }
コード例 #11
0
 public Answer GetAnswer(int ID)
 {
     using (CAAContext context = new CAAContext())
     {
         var answer = context.Answers
                      .Where(d => d.ID == ID).FirstOrDefault();
         return(answer);
     }
 }
コード例 #12
0
 public List <Answer> GetAnswersByQuestion(int ID)
 {
     using (CAAContext context = new CAAContext())
     {
         var answer = context.Answers
                      .Where(d => d.QuestionID == ID).ToList();
         return(answer);
     }
 }
コード例 #13
0
 public List <Answer> SearchAnswer(string search)
 {
     using (CAAContext context = new CAAContext())
     {
         var answer = context.Answers
                      .Where(d => d.Phrase.ToUpper().Contains(search.ToUpper())).ToList();
         return(answer);
     }
 }
コード例 #14
0
 public Game GetAGame(int ID)
 {
     using (CAAContext context = new CAAContext())
     {
         var game = context.Games
                    .Where(g => g.ID == ID).Include(q => q.Questions).FirstOrDefault();
         return(game);
     }
 }
 /// <summary>
 /// Get Last Event
 /// </summary>
 /// <returns>A Single EVENT</returns>
 public Event GetLastEvent()
 {
     using (CAAContext context = new CAAContext())
     {
         var lastEvent = context.Events
                         .LastOrDefault();
         return(lastEvent);
     }
 }
コード例 #16
0
 public List <Question> SearchQuestion(string search)
 {
     using (CAAContext context = new CAAContext())
     {
         var question = context.Questions
                        .Where(d => d.Phrase.ToUpper().Contains(search.ToUpper())).ToList();
         return(question);
     }
 }
コード例 #17
0
 public List <Game> GetGame(int ID)
 {
     using (CAAContext context = new CAAContext())
     {
         var game = context.Games
                    .Where(g => g.ID == ID).Include(q => q.Questions).ToList();
         return(game);
     }
 }
コード例 #18
0
 public List <Question> GetQuestionsByGame(int ID)
 {
     using (CAAContext context = new CAAContext())
     {
         var items = context.Questions
                     .Where(d => d.GameID == ID).ToList();
         return(items);
     }
 }
コード例 #19
0
 public Question GetQuestion(int ID)
 {
     using (CAAContext context = new CAAContext())
     {
         var question = context.Questions
                        .Where(d => d.ID == ID).FirstOrDefault();
         return(question);
     }
 }
コード例 #20
0
 /// <summary>
 /// Get All Question
 /// </summary>
 /// <returns></returns>
 public List <Question> GetQuestions()
 {
     using (CAAContext context = new CAAContext())
     {
         var items = context.Questions
                     .OrderBy(d => d.ID)
                     .ToList();
         return(items);
     }
 }
コード例 #21
0
 /// <summary>
 /// Get Item by ID
 /// </summary>
 /// <param name="itemID"></param>
 /// <returns>A Single ITEM</returns>
 public Item GetItem(string itemID)
 {
     using (CAAContext context = new CAAContext())
     {
         var item = context.Items
                    .Where(d => d.ItemID == itemID)
                    .FirstOrDefault();
         return(item);
     }
 }
コード例 #22
0
 /// <summary>
 /// Get all Items
 /// </summary>
 /// <returns>List of ITEMS</returns>
 public List <Item> GetItems()
 {
     using (CAAContext context = new CAAContext())
     {
         var items = context.Items
                     .OrderBy(d => d.ItemName)
                     .ToList();
         return(items);
     }
 }
コード例 #23
0
 /// <summary>
 /// Get AttendanceTrackings by EventID
 /// </summary>
 /// <param name="eventID"></param>
 /// <returns>List of ATTENDANCETRACKINGS</returns>
 public List <AttendanceTracking> GetAttendanceTrackingByEvent(string eventID)
 {
     using (CAAContext context = new CAAContext())
     {
         var attendanceTracking = context.AttendanceTrackings
                                  .Where(d => d.EventID == eventID)
                                  .ToList();
         return(attendanceTracking);
     }
 }
コード例 #24
0
 /// <summary>
 /// Get User by ID
 /// </summary>
 /// <param name="ID"></param>
 /// <returns>A Single USER</returns>
 public Users GetUser(int ID)
 {
     using (CAAContext context = new CAAContext())
     {
         var u = context.Users
                 .Where(d => d.ID == ID)
                 .FirstOrDefault();
         return(u);
     }
 }
コード例 #25
0
 /// <summary>
 /// Get AttendanceTracking by ID
 /// </summary>
 /// <param name="memberAttendanceID"></param>
 /// <returns>a Single ATTENDANCETRACKING</returns>
 public AttendanceTracking GetAttendanceTracking(string memberAttendanceID)
 {
     using (CAAContext context = new CAAContext())
     {
         var attendanceTracking = context.AttendanceTrackings
                                  .Where(d => d.MemberAttendanceID == memberAttendanceID)
                                  .FirstOrDefault();
         return(attendanceTracking);
     }
 }
コード例 #26
0
 /// <summary>
 /// Get AttendanceItem by ID
 /// </summary>
 /// <param name="attendanceItemID"></param>
 /// <returns>A Single ATTENDANCEITEMS</returns>
 public AttendanceItem GetAttendanceItem(string attendanceItemID)
 {
     using (CAAContext context = new CAAContext())
     {
         var attendanceItem = context.AttendanceItems
                              .Where(d => d.MemberAttendanceID == attendanceItemID)
                              .FirstOrDefault();
         return(attendanceItem);
     }
 }
コード例 #27
0
 /// <summary>
 /// Get All Answers
 /// </summary>
 /// <returns>List of ANSWERS</returns>
 public List <Answer> GetAnswers()
 {
     using (CAAContext context = new CAAContext())
     {
         var items = context.Answers.Include(a => a.AnswerPictures)
                     .OrderByDescending(o => o.TimesUsed)
                     .ToList();
         return(items);
     }
 }
コード例 #28
0
 /// <summary>
 /// Get all EventItems
 /// </summary>
 /// <returns>List of EVENTITEMS</returns>
 public List <EventItem> GetEventItems()
 {
     using (CAAContext context = new CAAContext())
     {
         var eventItems = context.EventItems
                          .OrderBy(d => d.EventItemID)
                          .ToList();
         return(eventItems);
     }
 }
コード例 #29
0
 /// <summary>
 /// Get all Users
 /// </summary>
 /// <returns>List of USERS</returns>
 public List <Users> GetUsers()
 {
     using (CAAContext context = new CAAContext())
     {
         var users = context.Users
                     .OrderBy(d => d.UserName)
                     .ToList();
         return(users);
     }
 }
コード例 #30
0
 /// <summary>
 /// Get EventItem by ID
 /// </summary>
 /// <param name="eventItemID"></param>
 /// <returns>A Single EVENTITEM</returns>
 public EventItem GetEventItem(string eventItemID)
 {
     using (CAAContext context = new CAAContext())
     {
         var eventItem = context.EventItems
                         .Where(d => d.EventItemID == eventItemID)
                         .FirstOrDefault();
         return(eventItem);
     }
 }