Exemplo n.º 1
0
        public string AddNewCompany(Company company)
        {
            List <Company> companies = new List <Company>();

            if (File.Exists(path))
            {
                companies = XMLReadWrite.ReadXML <List <Company> >(path);
            }

            companies.Add(company);
            return(XMLReadWrite.WriteXML <List <Company> >(companies, path));
        }
Exemplo n.º 2
0
        public string AddCar(Car car)
        {
            List <Car> cars = new List <Car>();

            if (File.Exists(path))
            {
                cars = XMLReadWrite.ReadXML <List <Car> >(path);
            }

            cars.Add(car);
            return(XMLReadWrite.WriteXML <List <Car> >(cars, path));
        }
Exemplo n.º 3
0
        public string UpdateCompany(Company company)
        {
            List <Company> newCompanies = new List <Company>();
            List <Company> companies    = XMLReadWrite.ReadXML <List <Company> >(path);

            foreach (Company c in companies)
            {
                if (c.Id != company.Id)
                {
                    newCompanies.Add(c);
                }
            }
            return("");
        }
Exemplo n.º 4
0
        public string UpdateCar(Car car)
        {
            List <Car> newCars = new List <Car>();
            List <Car> cars    = XMLReadWrite.ReadXML <List <Car> >(path);

            foreach (Car c in cars)
            {
                if (c.Id != car.Id)
                {
                    newCars.Add(c);
                }
            }
            return("");
        }
Exemplo n.º 5
0
        public string DeleteCompany(int id)
        {
            List <Company> newCompanies = new List <Company>();
            List <Company> companies    = XMLReadWrite.ReadXML <List <Company> >(path);

            foreach (Company c in companies)
            {
                if (c.Id != id)
                {
                    newCompanies.Add(c);
                }
            }
            XMLReadWrite.WriteXML <List <Company> >(newCompanies, path);
            return("");
        }
Exemplo n.º 6
0
        public string DeleteCar(int id)
        {
            List <Car> newCars = new List <Car>();
            List <Car> cars    = XMLReadWrite.ReadXML <List <Car> >(path);

            foreach (Car c in cars)
            {
                if (c.Id != id)
                {
                    newCars.Add(c);
                }
            }
            XMLReadWrite.WriteXML <List <Car> >(newCars, path);
            return("");
        }
Exemplo n.º 7
0
 public List <Company> GetCompanies()
 {
     return(XMLReadWrite.ReadXML <List <Company> >(path));
 }
Exemplo n.º 8
0
 public List <Car> GetCars()
 {
     return(XMLReadWrite.ReadXML <List <Car> >(path));
 }