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(); } }
public ActionResult Delete(int id) { using (CompaniesDAL context = new CompaniesDAL()) { BusinessLogic.DeleteNodes(context, id); context.SaveChanges(); } return(RedirectToAction("Index")); }
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(); } }
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(); } }