/// <summary> /// 根据ID获取功能 /// </summary> /// <param name="keyWord"></param> /// <returns></returns> public Function Get(string id) { using (DbContext db = new CRDatabase()) { CTMS_SYS_FUNCTION entity = db.Set <CTMS_SYS_FUNCTION>().Find(id); if (entity == null || string.IsNullOrEmpty(entity.FUNCTIONID)) { return(null); } return(EntityToModel(entity)); } }
/// <summary> /// 获取查询列表 /// </summary> /// <param name="keyWord"></param> /// <returns></returns> public MenuInfo GetOne(string ID) { using (DbContext db = new CRDatabase()) { CTMS_SYS_FUNCTION entity = db.Set <CTMS_SYS_FUNCTION>().Find(ID); if (entity == null || string.IsNullOrEmpty(entity.FUNCTIONID)) { return(null); } return(EntityToModel(entity)); } }
private MenuInfo EntityToModel(CTMS_SYS_FUNCTION entity) { if (entity == null) { return(null); } return(new MenuInfo() { ID = entity.FUNCTIONID, Name = entity.MENUNAME, Code = entity.MENUCODE, Icon = entity.MENUICON, ParentID = entity.PARENTID, IsExpand = entity.ISEXPAND, Url = entity.MENUURL, Sort = entity.SORT }); }
private Function EntityToModel(CTMS_SYS_FUNCTION entity) { if (entity == null) { return(null); } return(new Function() { FunctionID = entity.FUNCTIONID, FunctionName = entity.FUNCTIONNAME, FunctionCode = entity.FUNCTIONCODE, ParentID = entity.PARENTID, Status = (FunctionStatus)entity.STATUS, IsMenu = entity.ISMENU, Menu = entity.ISMENU ? new MenuInfo() { ID = entity.FUNCTIONID, Code = entity.MENUCODE, Icon = entity.MENUICON, IsExpand = entity.ISEXPAND, Name = entity.MENUNAME, Url = entity.MENUURL, ParentID = entity.PARENTID, Sort = entity.SORT } : null, IsPublic = entity.ISPUBLIC, HelperTitle = entity.HELPERTITLE, HelperUrl = entity.HELPERURL, Remark = entity.REMARK, Sort = entity.SORT, SystemCategory = entity.SYSTEMCATEGORY, CreateDateTime = entity.CREATEDATETIME, CreateUserID = entity.CREATEUSERID, CreateUserName = entity.CREATEUSERNAME, EditTime = entity.EDITDATETIME, EditUserID = entity.EDITUSERID, EditUserName = entity.EDITUSERNAME, OwnerID = entity.OWNERID, OwnerName = entity.OWNERNAME, IsDeleted = entity.ISDELETED }); }