public async Task <ActionResult <BirdPhoto> > PostBirdPhoto(BirdPhoto birdPhoto) { _context.BirdPhotos.Add(birdPhoto); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBirdPhoto", new { id = birdPhoto.Id }, birdPhoto)); }
public async Task <IActionResult> PutBirdPhoto(int id, BirdPhoto birdPhoto) { if (id != birdPhoto.Id) { return(BadRequest()); } _context.Entry(birdPhoto).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BirdPhotoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }