public async Task <NewsCategory> EditCategoryAsync(NewsCategory category)
        {
            VerifyManagementPermission();

            var currentCategory = await _newsCategoryRepository.GetByIdAsync(category.Id);

            currentCategory.Name = category.Name.Trim();

            return(await _newsCategoryRepository.UpdateSaveAsync(GetClaimId(ClaimType.UserId),
                                                                 currentCategory));
        }
Ejemplo n.º 2
0
        public async Task <NewsCategory> EditCategoryAsync(NewsCategory category)
        {
            VerifyManagementPermission();

            if (category == null)
            {
                throw new GraException("You must provide a category to edit.");
            }

            var currentCategory = await _newsCategoryRepository.GetByIdAsync(category.Id);

            currentCategory.Name = category.Name.Trim();

            return(await _newsCategoryRepository.UpdateSaveAsync(GetClaimId(ClaimType.UserId),
                                                                 currentCategory));
        }