public static List <Purchases> GetAllPurchases() { try { using (GymDBEntities g = new GymDBEntities()) return(g.Purchases.ToList()); } catch (Exception e) { return(null); } }
public static List <Customers> GetAllCustomers() { try { using (GymDBEntities g = new GymDBEntities()) return(g.Customers.ToList()); } catch (Exception e) { Console.WriteLine(e); return(null); } }
public static List <FitnessLessons> GetAllFitLe() { try { using (GymDBEntities g = new GymDBEntities()) { return(g.FitnessLessons.ToList()); } } catch (Exception e) { return(null); } }
public static List <SubscriptionsTypes> GetAllSubscription() { try { using (GymDBEntities g = new GymDBEntities()) { return(g.SubscriptionsTypes.ToList()); } } catch (Exception e) { return(null); } }
public static List <Training> GetAllTraining() { try { using (GymDBEntities g = new GymDBEntities()) { return(g.Training.ToList()); } } catch (Exception e) { return(null); } }
public static List <SystemMessege> GetAllMesseges() { try { using (GymDBEntities g = new GymDBEntities()) { return(g.SystemMessege.OrderByDescending(x => x.Creation_date).ToList()); } } catch (Exception e) { return(null); } }
public static List <ClosedGroupes> GetAllClosedGroups() { try { using (GymDBEntities g = new GymDBEntities()) { return(g.ClosedGroupes.ToList()); } } catch (Exception e) { return(null); } }
public static void PostPresence(Presence p) { try { using (GymDBEntities g = new GymDBEntities()) { g.Presence.Add(p); g.SaveChanges(); } } catch (Exception e) { Console.WriteLine(e); } }
public static void DeleteTraining(int id) { try { using (GymDBEntities g = new GymDBEntities()) { g.Training.Remove(g.Training.Where(a => a.training_id == id).First()); g.SaveChanges(); } } catch (Exception e) { Console.WriteLine(e); } }
public static void PostTrain(Training t) { try { using (GymDBEntities g = new GymDBEntities()) { g.Training.Add(t); g.SaveChanges(); } } catch (Exception e) { Console.WriteLine(e); } }
public static void DeleteCustomer(int id) { try { using (GymDBEntities g = new GymDBEntities()) { g.Customers.Remove(g.Customers.Where(x => x.customer_id == id).First()); g.SaveChanges(); } } catch (Exception e) { Console.WriteLine(e); } }
public static void PostCustomer(Customers c) { try { using (GymDBEntities g = new GymDBEntities()) { g.Customers.Add(c); g.SaveChanges(); } } catch (Exception e) { Console.WriteLine(e); } }
public static void DeleteFitnessLesson(int id) { try { using (GymDBEntities g = new GymDBEntities()) { g.FitnessLessons.Remove(g.FitnessLessons.Where(a => a.lesson_id == id).First()); g.SaveChanges(); } } catch (Exception e) { Console.WriteLine(e); } }
public static void DeleteClosedGroups(int id) { try { using (GymDBEntities g = new GymDBEntities()) { g.ClosedGroupes.Remove(g.ClosedGroupes.Where(a => a.team_id == id).First()); g.SaveChanges(); } } catch (Exception e) { Console.WriteLine(e); } }
public static void DeleteSMessege(int id) { try { using (GymDBEntities g = new GymDBEntities()) { g.SystemMessege.Remove(g.SystemMessege.Where(a => a.Messege_id == id).First()); g.SaveChanges(); } } catch (Exception e) { Console.WriteLine(e); } }
public static void PostClosedGroups(ClosedGroupes Cg) { try { using (GymDBEntities g = new GymDBEntities()) { g.ClosedGroupes.Add(Cg); g.SaveChanges(); } } catch (Exception e) { Console.WriteLine(e); } }
public static void DeleteSubscription(int id) { try { using (GymDBEntities g = new GymDBEntities()) { g.SubscriptionsTypes.Remove(g.SubscriptionsTypes.Where(a => a.sub_id == id).First()); g.SaveChanges(); } } catch (Exception e) { Console.WriteLine(e); } }
public static void PostSMessege(SystemMessege sm) { try { using (GymDBEntities g = new GymDBEntities()) { g.SystemMessege.Add(sm); g.SaveChanges(); } } catch (Exception e) { Console.WriteLine(e); } }
public static void PostFitnessLesson(FitnessLessons f) { try { using (GymDBEntities g = new GymDBEntities()) { g.FitnessLessons.Add(f); g.SaveChanges(); } } catch (Exception e) { Console.WriteLine(e); } }
public static void PostSubscription(SubscriptionsTypes s) { try { using (GymDBEntities g = new GymDBEntities()) { g.SubscriptionsTypes.Add(s); g.SaveChanges(); } } catch (Exception e) { Console.WriteLine(e); } }
public static List <FitnessLessons> GetLessonsByDay(string day) { try { using (GymDBEntities g = new GymDBEntities()) { List <FitnessLessons> f = new List <FitnessLessons>(); f = g.FitnessLessons.Where(x => x.day == day).ToList(); return(f); } } catch { return(null); } }
public static List <FitnessLessons> GetLessonsByType(int name) { try { using (GymDBEntities g = new GymDBEntities()) { List <FitnessLessons> f = new List <FitnessLessons>(); f = g.FitnessLessons.Where(x => x.name == name).ToList(); return(f); } } catch { return(null); } }
public static List <Purchases> GetPurchasesByPassword(string user_name, string password) { try { using (GymDBEntities g = new GymDBEntities()) { Customers cc = g.Customers.First(a => a.user_name == user_name && a.id_number == password); int customerId = cc.customer_id; List <Purchases> p = new List <Purchases>(); p = g.Purchases.Where(pp => pp.customer_id == customerId).ToList(); return(p); } } catch { return(null); } }
public static List <Presence> GetAllPresence() { try { using (GymDBEntities g = new GymDBEntities()) { return(null);/*g.Presence.GroupBy(p => p.lesson_id).OrderBy(o => o.Key).Select(s => s.Key);*/ //g.Presence.GroupBy(p => p.sub_id, // p => p.lesson_id, // (key, gr) => new { sub_id = key, lesson_id = gr.ToList() }); } } catch (Exception e) { return(null); } }
public static Customers GetOneCustomer(int id) { try { using (GymDBEntities g = new GymDBEntities()) foreach (var item in g.Customers) { if (item.customer_id == id) { return(item); } } return(null); } catch (Exception e) { return(null); } }
public static ClosedGroupes GetClosedGroups(int id) { try { using (GymDBEntities g = new GymDBEntities()) { foreach (var item in g.ClosedGroupes) { if (item.team_id == id) { return(item); } } return(null); } } catch (Exception e) { return(null); } }
public static SystemMessege GetMessege(int id) { try { using (GymDBEntities g = new GymDBEntities()) { foreach (var item in g.SystemMessege) { if (item.Messege_id == id) { return(item); } } return(null); } } catch (Exception e) { return(null); } }
public static SubscriptionsTypes GetSubscription(int id) { try { using (GymDBEntities g = new GymDBEntities()) { foreach (var item in g.SubscriptionsTypes) { if (item.sub_id == id) { return(item); } } return(null); } } catch (Exception e) { return(null); } }
public static Training GetTraining(int id) { try { using (GymDBEntities g = new GymDBEntities()) { foreach (var item in g.Training) { if (item.training_id == id) { return(item); } } return(null); } } catch (Exception e) { return(null); } }
public static FitnessLessons GetFitnesslesson(int id) { try { using (GymDBEntities g = new GymDBEntities()) { foreach (var item in g.FitnessLessons) { if (item.lesson_id == id) { return(item); } } return(null); } } catch (Exception e) { return(null); } }