Esempio n. 1
0
        public async Task <IActionResult> PutSpeaker(string id, Speaker speaker)
        {
            if (id != speaker.speakerId)
            {
                return(BadRequest());
            }

            _context.Entry(speaker).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SpeakerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task AddAsync(Speaker speaker)
        {
            await _speakers.AddAsync(speaker);

            await _context.SaveChangesAsync();
        }