public static Client ClientGetById(int id) { using (var db = new SalonContext(Options)) { return(db.Clients.Where(b => b.Id == id).FirstOrDefault()); } }
public static bool StylistCheckBySessionId(string session_id) { using (var db = new SalonContext(Options)) { var stylist = db.Stylists.Where(b => b.Session_id == session_id).FirstOrDefault(); return(stylist != null); } }
public static bool StylistExists(string login_name) { using (var db = new SalonContext(Options)) { var stylist = db.Stylists.Where(b => b.Login_name == login_name).FirstOrDefault(); return(stylist != null); } }
public static bool StylistExistsById(int id) { using (var db = new SalonContext(Options)) { var stylist = db.Stylists.Where(b => b.Id == id).FirstOrDefault(); return(stylist != null); } }
public static bool ClientExistsById(int id) { using (var db = new SalonContext(Options)) { var client = db.Clients.Where(b => b.Id == id).FirstOrDefault(); return(client != null); } }
public static List <Specialty> SpecialtyGetAll() { using (var db = new SalonContext(Options)) { var specialties = db.Specialties.ToList(); return(specialties); } }
public static Stylist StylistGetByName(string login_name) { using (var db = new SalonContext(Options)) { var stylist = db.Stylists.Where(b => b.Login_name == login_name).FirstOrDefault(); return(stylist); } }
public static void ClientRemoveAll() { using (var db = new SalonContext(Options)) { db.Clients.RemoveRange(db.Clients.ToArray()); db.SaveChanges(); } }
public static void ClientRemoveAllFromUser(int userId) { using (var db = new SalonContext(Options)) { db.Clients.RemoveRange(db.Clients.Include("Stylist").Where(b => b.Stylist == DB.StylistGetById(userId)).ToArray()); db.SaveChanges(); } }
public static void ClientRemove(int id) { using (var db = new SalonContext(Options)) { db.Clients.Remove(db.Clients.Where(b => b.Id == id).FirstOrDefault()); db.SaveChanges(); } }
public static Stylist StylistGetById(int id) { using (var db = new SalonContext(Options)) { var stylist = db.Stylists.Where(b => b.Id == id).FirstOrDefault(); return(stylist); } }
public static List <Client> ClientGetAllFromUser(int stylist_id) { using (var db = new SalonContext(Options)) { var clients = db.Clients.Include("Stylist").Where(b => b.Stylist == DB.StylistGetById(stylist_id)).ToList(); return(clients); } }
public static List <Client> ClientGetAll() { using (var db = new SalonContext(Options)) { var clients = db.Clients.Include("Stylist").ToList(); return(clients); } }
public static List <Stylist> StylistGetAll() { using (var db = new SalonContext(Options)) { var stylists = db.Stylists.ToList(); return(stylists); } }
public static void StylistUpdateSessionId(string login_name, string session_id) { using (var db = new SalonContext(Options)) { var stylist = db.Stylists.Where(b => b.Login_name == login_name).FirstOrDefault(); stylist.Session_id = session_id; db.SaveChanges(); } }
public static void StylistLogout(string session_id) { using (var db = new SalonContext(Options)) { var stylist = db.Stylists.Where(b => b.Session_id == session_id).FirstOrDefault(); stylist.Session_id = ""; db.SaveChanges(); } }
public static long StylistCreate(string login_name, string session_id, string name, string password) { Stylist stylist = new Stylist { Login_name = login_name, Session_id = session_id, Name = name, Password = password }; using (var db = new SalonContext(Options)) { db.Stylists.Add(stylist); db.SaveChanges(); } return(stylist.Id); }
public static long SpecialtyCreate(int stylist_id, string name, string phone_number, string alt_phone_number) { using (var db = new SalonContext(Options)) { Stylist stylist = db.Stylists.Where(b => b.Id == stylist_id).FirstOrDefault(); Client client = new Client { Stylist = stylist, Name = name, Phone_number = phone_number, Alt_phone_number = alt_phone_number }; db.Clients.Add(client); db.SaveChanges(); return(client.Id); } }
public static long ClientUpdate(int stylist_id, string name, string phone_number, string alt_phone_number, int clientId) { using (var db = new SalonContext(Options)) { Stylist stylist = db.Stylists.Where(b => b.Id == stylist_id).FirstOrDefault(); var client = db.Clients.Where(b => b.Id == clientId).FirstOrDefault(); client.Name = name; client.Phone_number = phone_number; client.Alt_phone_number = alt_phone_number; client.Stylist = stylist; db.SaveChanges(); return(client.Id); } }
public static long StylistUpdate(int userId, string login_name, string session_id, string name, string password) { using (var db = new SalonContext(Options)) { Stylist stylist = db.Stylists.Where(b => b.Id == userId).FirstOrDefault(); stylist.Login_name = login_name; stylist.Session_id = session_id; stylist.Name = name; stylist.Password = password; db.Update(stylist); db.SaveChanges(); return(stylist.Id); } }