/// <summary> /// 用于向 Actions EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet<T> 属性的 .Add 方法。 /// </summary> public void AddToActions(Actions actions) { base.AddObject("Actions", actions); }
/// <summary> /// 创建新的 Actions 对象。 /// </summary> /// <param name="id">ID 属性的初始值。</param> /// <param name="menuName">MenuName 属性的初始值。</param> /// <param name="isMenu">IsMenu 属性的初始值。</param> /// <param name="isAjax">IsAjax 属性的初始值。</param> /// <param name="isNeedAuth">IsNeedAuth 属性的初始值。</param> public static Actions CreateActions(global::System.Int32 id, global::System.String menuName, global::System.Boolean isMenu, global::System.Boolean isAjax, global::System.Boolean isNeedAuth) { Actions actions = new Actions(); actions.ID = id; actions.MenuName = menuName; actions.IsMenu = isMenu; actions.IsAjax = isAjax; actions.IsNeedAuth = isNeedAuth; return actions; }
public ActionResult Menu(Actions model) { var old = _uow.ActionsService.Get(t => t.ID == model.ID); if (old == null) { _uow.ActionsService.Add(model); } else { old.MenuCode = model.MenuCode; old.MenuName = model.MenuName; old.ParentID = model.ParentID; old.IsMenu = model.IsMenu; old.IsAjax = model.IsAjax; old.ResourceKey = model.ResourceKey; old.IsNeedAuth = model.IsNeedAuth; old.SortNumber = model.SortNumber; } _uow.Commit(); return RedirectToAction("Menu"); }