public void AddCircular(Circular circular) { using (ContextClass contextClass = new ContextClass()) { contextClass.Circulars.Add(circular); contextClass.SaveChanges(); } }
public void AddDepartment(Department department) { using (ContextClass contextClass = new ContextClass()) { contextClass.departments.Add(department); contextClass.SaveChanges(); } }
public void AddAccount(Account account) { using (ContextClass contextClass = new ContextClass()) { contextClass.Accounts.Add(account); contextClass.SaveChanges(); } }
public void AddEmployee(Employee employee) { using (ContextClass contextClass = new ContextClass()) { contextClass.Employees.Add(employee); contextClass.SaveChanges(); } }
public void EditEmployee(Employee employee) { using (ContextClass contextClass = new ContextClass()) { contextClass.Entry(employee).State = System.Data.Entity.EntityState.Modified; contextClass.SaveChanges(); } }
public void DeleteDepartment(Department department) { using (ContextClass contextClass = new ContextClass()) { Department departmentDetail = contextClass.departments.Where(id => id.DepartmentId == department.DepartmentId).SingleOrDefault(); contextClass.departments.Attach(departmentDetail); contextClass.departments.Remove(departmentDetail); contextClass.SaveChanges(); } }