public async Task <IActionResult> PutMoviestar(string id, Moviestar moviestar) { if (id != moviestar.Name) { return(BadRequest()); } _context.Entry(moviestar).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MoviestarExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Moviestar> > PostMoviestar(Moviestar moviestar) { _context.Moviestar.Add(moviestar); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (MoviestarExists(moviestar.Name)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetMoviestar", new { id = moviestar.Name }, moviestar)); }