public async Task <IActionResult> PutVisitedUrl(long id, VisitedUrl visitedUrl) { if (id != visitedUrl.Id) { return(BadRequest()); } if (!VisitedUrlExists(id)) { return(NotFound()); } _context.Entry(visitedUrl).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (Exception) { throw; } return(NoContent()); }
public async Task <ActionResult <VisitedUrl> > PostVisitedUrl(VisitedUrl visitedUrl) { _context.VisitedUrls.Add(visitedUrl); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetVisitedUrl), new { id = visitedUrl.Id }, visitedUrl)); }