Ejemplo n.º 1
0
        /// <summary>
        /// 新增页面元素
        /// </summary>
        public virtual async Task <PageChildElementDto> CreatePageChildElement(PageChildElementDto input)
        {
            //if (await _pageChildElementRepository.IsExistsPageChildElementByName(input.CategoryName))
            //{
            //    throw new UserFriendlyException(L("NameIsExists"));
            //}
            var entity = await _pageChildElementRepository.InsertAsync(input.MapTo <PageChildElement>());

            return(entity.MapTo <PageChildElementDto>());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新页面元素
        /// </summary>
        public virtual async Task UpdatePageChildElement(PageChildElementDto input)
        {
            //if (await _pageChildElementRepository.IsExistsPageChildElementByName(input.CategoryName, input.Id))
            //{
            //    throw new UserFriendlyException(L("NameIsExists"));
            //}
            var entity = await _pageChildElementRepository.GetAsync(input.Id);

            var s = await _pageChildElementRepository.UpdateAsync(input.MapTo(entity));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 新增或更改页面元素
 /// </summary>
 public async Task CreateOrUpdatePageChildElement(PageChildElementDto input, string img)
 {
     input.Url = HttpUtility.UrlDecode(img);
     if (input.Id == 0)
     {
         await CreatePageChildElement(input);
     }
     else
     {
         await UpdatePageChildElement(input);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 删除页面
 /// </summary>
 public async Task DeletePageChildElement(PageChildElementDto input)
 {
     //TODO:删除前的逻辑判断,是否允许删除
     await _pageChildElementRepository.DeleteAsync(input.Id);
 }