示例#1
0
 public void MoveCompany(int nodeId, int?newParentId)
 {
     using (CompaniesDAL dal = new CompaniesDAL())
     {
         Companies company = dal.Companies.Where(x => x.Id == nodeId).Single();
         company.ParentId = newParentId;
         dal.SaveChanges();
     }
 }
示例#2
0
        public ActionResult Delete(int id)
        {
            using (CompaniesDAL context = new CompaniesDAL())
            {
                BusinessLogic.DeleteNodes(context, id);
                context.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
示例#3
0
 public void UpdateCompanies(int?nodeId, string title, int?earnings)
 {
     using (CompaniesDAL dal = new CompaniesDAL())
     {
         Companies company = dal.Companies.Where(x => x.Id == nodeId).Single();
         company.Title    = title;
         company.Earnings = earnings;
         dal.SaveChanges();
     }
 }
示例#4
0
 public void AddCompanies(int?parentId, string title, int?earnings)
 {
     using (CompaniesDAL dal = new CompaniesDAL())
     {
         Companies company = new Companies()
         {
             ParentId = parentId,
             Title    = title,
             Earnings = earnings
         };
         dal.Companies.Add(company);
         dal.SaveChanges();
     }
 }