Example #1
0
        public Tag UpdateTag(UpdateTagInput inputTag)
        {
            _logger.LogInformation($"Updating tag (id = {inputTag.Id})");

            var tagEntity = _data.EfContext.Tags.Find(inputTag.Id);

            tagEntity.Title       = inputTag.Title ?? tagEntity.Title;
            tagEntity.Description = inputTag.Description ?? tagEntity.Description;

            _data.EfContext.Tags.Update(tagEntity);
            _data.EfContext.SaveChanges();

            _logger.LogInformation($"Tag (id = {inputTag.Id}) is updated successfully");
            return(tagEntity);
        }
Example #2
0
        public async Task <BlogResponse> UpdateTagAsync(string id, UpdateTagInput input)
        {
            var response = new BlogResponse();

            var tag = await _tags.FindAsync(id.ToObjectId());

            if (tag is null)
            {
                response.IsFailed($"The tag id not exists.");
                return(response);
            }

            tag.Name  = input.Name;
            tag.Alias = input.Alias;

            await _tags.UpdateAsync(tag);

            return(response);
        }
Example #3
0
 public async Task UpdateTag(UpdateTagInput input)
 {
     await _aliyunOSSManager.UpdateDirectoryOrFileTag(input);
 }