public void InsertUser_action(user_action user_action) { if ((user_action.EntityState != EntityState.Detached)) { this.ObjectContext.ObjectStateManager.ChangeObjectState(user_action, EntityState.Added); } else { this.ObjectContext.user_action.AddObject(user_action); } }
public void DeleteUser_action(user_action user_action) { if ((user_action.EntityState != EntityState.Detached)) { this.ObjectContext.ObjectStateManager.ChangeObjectState(user_action, EntityState.Deleted); } else { this.ObjectContext.user_action.Attach(user_action); this.ObjectContext.user_action.DeleteObject(user_action); } }
/// <summary> /// 完成用户权限的分配 /// </summary> /// <param name="userId"></param> /// <param name="actionId"></param> /// <param name="isPass"></param> /// <returns></returns> public bool SetUserActionInfo(int userId, int actionId, bool isPass) { var userInfo_actionInfo = this.GetCurrentDbSession.user_actionDal.LoadEntities(r => r.User_ID == userId && r.Act_ID == actionId).FirstOrDefault(); if (userInfo_actionInfo == null) { user_action user_action1 = new user_action(); user_action1.Act_ID = actionId; user_action1.User_ID = userId; user_action1.isPass = isPass; this.GetCurrentDbSession.user_actionDal.AddEntity(user_action1); } else { userInfo_actionInfo.isPass = isPass; this.GetCurrentDbSession.user_actionDal.EditEntity(userInfo_actionInfo); } return(this.GetCurrentDbSession.SaveChanges()); }
public void UpdateUser_action(user_action currentuser_action) { this.ObjectContext.user_action.AttachAsModified(currentuser_action, this.ChangeSet.GetOriginal(currentuser_action)); }