Esempio n. 1
0
        public async Task <ActionResult <Employee> > PostTodoItem(Employee employee)
        {
            _context.Employees.Add(employee);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTodoItem", new { id = employee.Id }, employee));
        }
Esempio n. 2
0
        public async Task <IActionResult> PutPlaylist(long id, Playlist playlist)
        {
            if (id != playlist.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }