public static bool ModifyExistingClientProfile(DataModels.ClientProfile ClientProfileModel)
        {
            var db = new ITAPPCarWorkshopServiceDBEntities();

            bool profileExists = false;

            mutex.WaitOne();

            if (!CheckIfClientProfileExists(ClientProfileModel))
            {
                profileExists = false;
                mutex.ReleaseMutex();
                return(profileExists);
            }

            try
            {
                Client_Profiles ClientProfileEntity = db.Client_Profiles.FirstOrDefault(n => n.Client_ID == ClientProfileModel.ClientID);

                ClientProfileEntity.Client_name         = ClientProfileModel.ClientName;
                ClientProfileEntity.Client_surname      = ClientProfileModel.ClientSurname;
                ClientProfileEntity.Client_phone_number = ClientProfileModel.ClientPhoneNumber;

                db.SaveChanges();
                mutex.ReleaseMutex();
                return(true);
            }
            catch (Exception e)
            {
                mutex.ReleaseMutex();
                return(false);
            }
        }
        public static bool DeleteClientProfileFromDB(int ClientProfileID)
        {
            var db = new ITAPPCarWorkshopServiceDBEntities();

            bool profileExists = false;

            mutex.WaitOne();

            if (!CheckIfClientProfileExists(ClientProfileID))
            {
                profileExists = false;
                mutex.ReleaseMutex();
                return(profileExists);
            }

            try
            {
                Client_Profiles ClientProfileEntity = db.Client_Profiles.FirstOrDefault(n => n.Client_ID == ClientProfileID);
                db.Client_Profiles.Remove(ClientProfileEntity);
                db.SaveChanges();
                mutex.ReleaseMutex();
                return(true);
            }
            catch (Exception e)
            {
                mutex.ReleaseMutex();
                return(false);
            }
        }
        public Client_Profiles MakeEntityFromModel()
        {
            var entityProfile = new Client_Profiles()
            {
                Client_ID           = ClientID,
                User_ID             = UserID,
                Client_name         = ClientName,
                Client_surname      = ClientSurname,
                Client_phone_number = ClientPhoneNumber,
            };

            return(entityProfile);
        }
        public static bool PutNewClientProfileToDB(DataModels.ClientProfile NewClientProfileModel)
        {
            var db = new ITAPPCarWorkshopServiceDBEntities();

            Client_Profiles NewClientProfileEntity = NewClientProfileModel.MakeEntityFromModel();

            try
            {
                mutex.WaitOne();

                db.Client_Profiles.Add(NewClientProfileEntity);
                db.SaveChanges();

                mutex.ReleaseMutex();

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }