Ejemplo n.º 1
0
 public static Client ClientGetById(int id)
 {
     using (var db = new SalonContext(Options))
     {
         return(db.Clients.Where(b => b.Id == id).FirstOrDefault());
     }
 }
Ejemplo n.º 2
0
 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);
     }
 }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
 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);
     }
 }
Ejemplo n.º 5
0
 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);
     }
 }
Ejemplo n.º 6
0
 public static List <Specialty> SpecialtyGetAll()
 {
     using (var db = new SalonContext(Options))
     {
         var specialties = db.Specialties.ToList();
         return(specialties);
     }
 }
Ejemplo n.º 7
0
 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);
     }
 }
Ejemplo n.º 8
0
 public static void ClientRemoveAll()
 {
     using (var db = new SalonContext(Options))
     {
         db.Clients.RemoveRange(db.Clients.ToArray());
         db.SaveChanges();
     }
 }
Ejemplo n.º 9
0
 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();
     }
 }
Ejemplo n.º 10
0
 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();
     }
 }
Ejemplo n.º 11
0
 public static Stylist StylistGetById(int id)
 {
     using (var db = new SalonContext(Options))
     {
         var stylist = db.Stylists.Where(b => b.Id == id).FirstOrDefault();
         return(stylist);
     }
 }
Ejemplo n.º 12
0
 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);
     }
 }
Ejemplo n.º 13
0
 public static List <Client> ClientGetAll()
 {
     using (var db = new SalonContext(Options))
     {
         var clients = db.Clients.Include("Stylist").ToList();
         return(clients);
     }
 }
Ejemplo n.º 14
0
 public static List <Stylist> StylistGetAll()
 {
     using (var db = new SalonContext(Options))
     {
         var stylists = db.Stylists.ToList();
         return(stylists);
     }
 }
Ejemplo n.º 15
0
 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();
     }
 }
Ejemplo n.º 16
0
 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();
     }
 }
Ejemplo n.º 17
0
        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);
        }
Ejemplo n.º 18
0
 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);
     }
 }
Ejemplo n.º 19
0
 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);
     }
 }
Ejemplo n.º 20
0
 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);
     }
 }