public IActionResult Post([FromBody] NewCollectionPresentation item) { if (item == null) { return(BadRequest()); } item.Id = _context.NewCollectionPresentations.Count() + 1; _context.NewCollectionPresentations.Add(item); _context.SaveChanges(); return(CreatedAtRoute("GetBrand", new { id = item.Id }, item)); }
public IActionResult Update(long id, [FromBody] NewCollectionPresentation item) { if (item == null || item.Id != id) { return(BadRequest()); } var presentation = _context.NewCollectionPresentations.FirstOrDefault(t => t.Id == id); if (presentation == null) { return(NotFound()); } presentation.SeasonId = item.SeasonId; presentation.Venue = item.Venue; presentation.DateOfPerformance = item.DateOfPerformance; _context.NewCollectionPresentations.Update(presentation); _context.SaveChanges(); return(new NoContentResult()); }