public WorkingPoint AddWorkingPoint(WorkingPoint WorkingPoint)
        {
            VehicleServiceCompany CurrentService = ServiceBookContext.VehicleServiceCompany.FirstOrDefault(x => x.ID == WorkingPoint.VSCID);
            WorkingPoint          workingpoint   = ServiceBookContext.WorkingPoint.FirstOrDefault(x => x.City == WorkingPoint.City && x.Country == WorkingPoint.Country && x.Street == WorkingPoint.Street && x.Nr == WorkingPoint.Nr);

            if (workingpoint != null)
            {
                if (workingpoint.Flag == 0)
                {
                    return(null);
                }
                else
                {
                    workingpoint.VehicleServiceCompany = CurrentService;
                    workingpoint.Flag = 0;
                    ServiceBookContext.SaveChanges();
                    WorkingPoint = workingpoint;
                }
            }
            else
            {
                WorkingPoint.VehicleServiceCompany = CurrentService;
                WorkingPoint.Flag = 0;
                ServiceBookContext.WorkingPoint.Add(WorkingPoint);
                ServiceBookContext.SaveChanges();
            }



            return(WorkingPoint);
        }
        public void DeletWorkingPoint(WorkingPoint WorkingPoint)
        {
            WorkingPoint DeletWorkingPoint = ServiceBookContext.WorkingPoint.FirstOrDefault(x => x.ID == WorkingPoint.ID);

            DeletWorkingPoint.Flag = 1;
            ServiceBookContext.SaveChanges();
        }
        public void EditWorkingPoint(WorkingPoint WorkingPoint)
        {
            WorkingPoint workingPoint = ServiceBookContext.WorkingPoint.FirstOrDefault(x => x.ID == WorkingPoint.ID);

            workingPoint.Nr      = WorkingPoint.Nr;
            workingPoint.Street  = WorkingPoint.Street;
            workingPoint.City    = WorkingPoint.City;
            workingPoint.Country = WorkingPoint.Country;
            ServiceBookContext.SaveChanges();
        }
 public ServiceIntervention AddIntervention(ServiceIntervention ServiceIntervention)
 {
     WorkingPoint WorkingPoint=ServiceBookContext.WorkingPoint.FirstOrDefault(x => x.ID == ServiceIntervention.WP);
     ServiceIntervention serviceIntervention = WorkingPoint.ServiceInterventions.FirstOrDefault(x => x.Name == ServiceIntervention.Name);
     if (serviceIntervention == null)
     {
         ServiceIntervention.WorkingPoint = WorkingPoint;
         ServiceIntervention.Currency = new Currency();
         ServiceIntervention.Currency.Name = "Euro";
         ServiceIntervention.Flag = 0;
         ServiceBookContext.ServiceIntervention.Add(ServiceIntervention);
         ServiceBookContext.SaveChanges();
         return ServiceIntervention;
     }
     else
         return null;
 }
        public Employee AddEmployee(Employee Employee)
        {
            WorkingPoint WorkingPoint = ServiceBookContext.WorkingPoint.FirstOrDefault(x => x.ID == Employee.WPID);
            Employee     employee     = WorkingPoint.Employees.FirstOrDefault(x => x.PhoneNumber == Employee.PhoneNumber);

            if (employee == null)
            {
                Employee.Flag = 0;
                WorkingPoint.Employees.Add(Employee);
                ServiceBookContext.SaveChanges();
                return(Employee);
            }

            else
            {
                return(null);
            }
        }