Example #1
0
        public async Task <Tag> AddTagAsync(AddTagInput input, [ScopedService] ApplicationDbContext _context)
        {
            Tag new_tag = new Tag
            {
                Name = input.name
            };

            _context.Tags.Add(new_tag);
            await _context.SaveChangesAsync();

            return(new_tag);
        }
Example #2
0
        public async Task <AddTagPayload> AddTagAsync(AddTagInput input,
                                                      [ScopedService] ApiContext context)
        {
            Tag tag = new()
            {
                Name = input.Name
            };

            tag = context.Tags.Add(tag).Entity;

            await context.SaveChangesAsync()
            .ConfigureAwait(false);

            return(new AddTagPayload(tag));
        }