Ejemplo n.º 1
0
        public async Task <AddSpeakerPayload> AddSpeakerAsync(
            AddSpeakerInput input,
            [ScopedService] ApplicationDbContext context)
        {
            var speaker = new Speaker
            {
                Name    = input.Name,
                Bio     = input.Bio,
                WebSite = input.WebSite
            };

            context.Speakers.Add(speaker);
            await context.SaveChangesAsync();

            return(new AddSpeakerPayload(speaker));
        }
Ejemplo n.º 2
0
        public async Task <AddSpeakerPayload> AddSpeakerAsync(
            AddSpeakerInput input,
            [ScopedService] ApplicationDbContext context,
            CancellationToken cancellationToken)
        {
            var speaker = new Speaker
            {
                Name    = input.Name,
                Bio     = input.Bio,
                WebSite = input.WebSite
            };

            context.Speakers.Add(speaker);
            await context.SaveChangesAsync(cancellationToken);

            return(new AddSpeakerPayload(speaker, input.ClientMutationId));
        }