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(); } }
/// <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); } }
/// <summary> /// Add /// </summary> /// <param name="itemToAdd"></param> public void AddItem(Item itemToAdd) { using (CAAContext context = new CAAContext()) { context.Items.Add(itemToAdd); context.SaveChanges(); } }
/// <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(); } }
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); } }
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); } }
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); } }
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); } }
public List <Question> GetQuestionsByGame(int ID) { using (CAAContext context = new CAAContext()) { var items = context.Questions .Where(d => d.GameID == ID).ToList(); return(items); } }
public Question GetQuestion(int ID) { using (CAAContext context = new CAAContext()) { var question = context.Questions .Where(d => d.ID == ID).FirstOrDefault(); return(question); } }
/// <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); } }
/// <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); } }
/// <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); } }
/// <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); } }
/// <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); } }
/// <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); } }
/// <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); } }
/// <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); } }
/// <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); } }
/// <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); } }
/// <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); } }