public async Task <IActionResult> PutReview(int id, Review review) { if (id != review.Id) { return(BadRequest()); } _context.Entry(review).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReviewExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutStudio(int id, Studio studio) { if (id != studio.Id) { return(BadRequest()); } _context.Entry(studio).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudioExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
//ta bort en trivia //nullar endast trivia istället för hela obj för att kunna fortf räkna ut medelbetyg public async Task <ActionResult <Review> > RemoveReview(int id) { var toRemove = await _context.Reviews.FindAsync(id); toRemove.Trivia = null; await _context.SaveChangesAsync(); return(toRemove); }
public async Task <ActionResult <Assosiation> > UppdateAsosiation(Assosiation assosiation, int id) { var toUpdate = await _context.Assosiations.FindAsync(id); if (toUpdate.Id != id) { return(StatusCode(500)); } toUpdate.Location = assosiation.Location; toUpdate.Name = assosiation.Name; await _context.SaveChangesAsync(); return(toUpdate); }