public void Delete(int id)
 {
     using (TimeTrackerEntities db = new TimeTrackerEntities())
     {
         try
         {
             T_RoleDepartmentAccess t_roledepartmentaccess = new T_RoleDepartmentAccess();
             t_roledepartmentaccess = db.T_RoleDepartmentAccess.FirstOrDefault(p => p.Id == id);
             db.T_RoleDepartmentAccess.Remove(t_roledepartmentaccess);
             db.SaveChanges();
         }
         catch (Exception ex)
         {
             string msg = ex.Message;
         }
     }
 }
        public void Insert(RoleDepartmentAccess roledepartmentaccess)
        {
            T_RoleDepartmentAccess t_roledepartmentaccess = new T_RoleDepartmentAccess();
            Parse(t_roledepartmentaccess, roledepartmentaccess);

            using (TimeTrackerEntities db = new TimeTrackerEntities())
            {
                try
                {
                    db.T_RoleDepartmentAccess.Add(t_roledepartmentaccess);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    string msg = ex.Message;
                }
            }
        }
 private void Parse(T_RoleDepartmentAccess t_roledepartmentaccess, RoleDepartmentAccess roledepartmentaccess)
 {
     t_roledepartmentaccess.RoleId = roledepartmentaccess.RoleId;
     t_roledepartmentaccess.DepartmentId = roledepartmentaccess.DepartmentId;
 }