Пример #1
0
        public async ValueTask <KSociety.Com.App.Dto.Res.Remove.Common.TagGroup> ExecuteAsync(TagGroup request, CancellationToken cancellationToken = default)
        {
            var commonTagGroup = await _tagGroupRepository.FindAsync(cancellationToken, request.Id).ConfigureAwait(false); //.GetAllTagGroup().SingleOrDefault(tag => tag.Id == request.Id);

            _tagGroupRepository.Delete(commonTagGroup);

            return(new KSociety.Com.App.Dto.Res.Remove.Common.TagGroup(await _unitOfWork.CommitAsync(cancellationToken).ConfigureAwait(false) > 0));
        }
Пример #2
0
        public async ValueTask <KSociety.Com.App.Dto.Res.ModifyField.Common.TagGroup> ExecuteAsync(TagGroup request, CancellationToken cancellationToken = default)
        {
            var commonTagGroup = await _tagGroupRepository.FindAsync(cancellationToken, request.Id).ConfigureAwait(false); //.GetAllTagGroup().SingleOrDefault(tagGroup => tagGroup.Id == request.Id);

            commonTagGroup?.ModifyField(request.FieldName, request.Value);

            var result = await _unitOfWork.CommitAsync(cancellationToken).ConfigureAwait(false);

            return(new KSociety.Com.App.Dto.Res.ModifyField.Common.TagGroup(result > 0));
        }
Пример #3
0
        public async ValueTask <Srv.Dto.Common.TagGroup> GetTagGroupByIdAsync(IdObject idObject, CallContext context = default)
        {
            Domain.Entity.Common.TagGroup tagGroup = null;
            _logger.LogTrace("Query Behavior: " + GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod()?.Name);
            try
            {
                tagGroup = await _commonTagGroupRepository.FindAsync(context.CancellationToken, idObject.Id);
            }
            catch (Exception ex)
            {
                _logger.LogError("Query Behavior: " + GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod()?.Name + " " + ex.Message + " - " + ex.StackTrace);
            }

            return(new TagGroup(tagGroup.Id, tagGroup.Name, tagGroup.Clock, tagGroup.Update, tagGroup.Enable));
        }