Exemple #1
0
        protected async Task UpdateGroupAsync(CreateOrUpdatePictureGroupInput input)
        {
            var pictureGroup = await _pictureManager.GetGroupByIdAsync(input.Id.Value);

            if (pictureGroup.IsSystemGroup)
            {
                throw new UserFriendlyException(L("PictureGallery.Group.SystemGroup.CantNotUpdate"));
            }

            var existedGroup = await _pictureManager.GetGroupByNameAsync(input.Name);

            if (existedGroup != null && pictureGroup.Id != existedGroup.Id)
            {
                throw new UserFriendlyException(string.Format(L("PictureGallery.Group.Existed"), input.Name));
            }

            pictureGroup.Name = input.Name;

            await _pictureManager.UpdateGroupAsync(pictureGroup);
        }