예제 #1
0
        /// <summary>
        /// 修改实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task UpdateMenuItemAsync(CreateOrUpdateMenuItemInput input)
        {
            Debug.Assert(input.MenuItem.Id != null, "input.MenuItem.Id should be set.");

            var menuItem = await _menuItemRepository.GetAsync(input.MenuItem.Id);
            menuItem = input.MenuItem.MapTo<AuthorityMenuItemInfo>();
            menuItem.LastModifierUserId = YLSession.UserId;
            menuItem.LastModifierUserName = "";
            menuItem.LastModificationTime = Clock.Now;
            await _menuItemRepository.UpdateAsync(menuItem);

        }
예제 #2
0
 /// <summary>
 /// 创建实体
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public async Task CreateMenuItemAsync(CreateOrUpdateMenuItemInput input)
 {
     var menuItem = input.MenuItem.MapTo<AuthorityMenuItemInfo>();
     menuItem.CreatorUserId = YLSession.UserId;
     menuItem.CreatorUserName = "";
     menuItem.CreationTime = Clock.Now;
     await _menuItemRepository.InsertAsync(menuItem);
 }
예제 #3
0
        /// <summary>
        /// 修改实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        protected virtual async Task UpdateMenuItemAsync(CreateOrUpdateMenuItemInput input)
        {
            Debug.Assert(input.MenuItem.Id != Guid.Empty, "input.MenuItem.Id should be set.");
            //var menuItem = await _menuItemRepository.FirstOrDefaultAsync(input.MenuItem.Id);
            var menuItem = input.MenuItem.MapTo<AuthorityMenuItemInfo>();

            menuItem.LastModifierUserId = YLSession.UserId;
            menuItem.LastModifierUserName ="";
            menuItem.LastModificationTime = Clock.Now;
            await _menuItemRepository.UpdateAsync(menuItem);
            cacheHandler.Remove(CacheCategoryMenuItem, "GetMenuItemList");

        }
예제 #4
0
        /// <summary>
        /// 创建实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        protected virtual async Task CreateMenuItemAsync(CreateOrUpdateMenuItemInput input)
        {
            var menuItem = input.MenuItem.MapTo<AuthorityMenuItemInfo>();

            menuItem.AppCode = "YLMMISV8.0";
            menuItem.Id = GuidHelper.NewGuid();
            menuItem.CreatorUserId = YLSession.UserId;
            menuItem.CreatorUserName = "";
            menuItem.CreationTime = Clock.Now;
            await _menuItemRepository.InsertAsync(menuItem);
            cacheHandler.Remove(CacheCategoryMenuItem, "GetMenuItemList");
        }
예제 #5
0
 /// <summary>
 /// 修改添加实体
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public async Task CreateOrUpdateMenuItem(CreateOrUpdateMenuItemInput input)
 {
     if (input.MenuItem.Id != null && input.MenuItem.Id != Guid.Empty)
     {
         await UpdateMenuItemAsync(input);
     }
     else
     {
         await CreateMenuItemAsync(input);
     }
 }