Esempio n. 1
0
        public static Company EditCompany(Company company)
        {
            context = new CompaniesTreeEntities();
            var companyDB = context.Companies.First(c => c.ID == company.ID);

            companyDB.Earning = company.Earning;
            companyDB.Name    = company.Name;
            context.SaveChanges();
            return(GetDataForTree());
        }
Esempio n. 2
0
 public static Company DeleteCompany(int clickedID)
 {
     context = new CompaniesTreeEntities();
     if (clickedID != 25)
     {
         var companyDB = context.Companies.First(c => c.ID == clickedID);
         // RemoveBelonged(clickedID);
         context.Companies.Remove(companyDB);
         context.SaveChanges();
     }
     return(GetDataForTree());
 }
Esempio n. 3
0
 public static Company AddNewCompany(Company newCompany)
 {
     context = new CompaniesTreeEntities();
     context.Companies.Add(new Companies()
     {
         Name       = newCompany.Name,
         Earning    = newCompany.Earning,
         BelongToID = newCompany.ID
     });
     context.SaveChanges();
     return(GetDataForTree());
 }