예제 #1
0
        /// <summary>
        /// 更新页面元素
        /// </summary>
        public virtual async Task UpdatePageElement(PageElementUpdateDto input)
        {
            //if (await _pageElementRepository.IsExistsPageElementByName(input.CategoryName, input.Id))
            //{
            //    throw new UserFriendlyException(L("NameIsExists"));
            //}
            var entity = await _pageElementRepository.GetAsync(input.Id);

            await _pageElementRepository.UpdateAsync(input.MapTo(entity));
        }
예제 #2
0
        /// <summary>
        /// 新增页面元素
        /// </summary>
        public virtual async Task <PageElementDto> CreatePageElement(PageElementUpdateDto input)
        {
            //if (await _pageElementRepository.IsExistsPageElementByName(input.CategoryName))
            //{
            //    throw new UserFriendlyException(L("NameIsExists"));
            //}
            var entity = await _pageElementRepository.InsertAsync(input.MapTo <PageElement>());

            return(entity.MapTo <PageElementDto>());
        }