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();
     }
 }
 /// <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();
     }
 }
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="eventToUpdate"></param>
 public void UpdateEvent(Event eventToUpdate)
 {
     using (CAAContext context = new CAAContext())
     {
         context.Update(eventToUpdate);
         context.SaveChanges();
     }
 }
 /// <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);
     }
 }
 public Answer GetAnswer(int ID)
 {
     using (CAAContext context = new CAAContext())
     {
         var answer = context.Answers
                      .Where(d => d.ID == ID).FirstOrDefault();
         return(answer);
     }
 }
 public List <Answer> GetAnswersByQuestion(int ID)
 {
     using (CAAContext context = new CAAContext())
     {
         var answer = context.Answers
                      .Where(d => d.QuestionID == ID).ToList();
         return(answer);
     }
 }
 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);
     }
 }