public async Task <ActionResult <DoggoFriend> > PostDoggoFriend(DoggoFriend doggoFriend) { _context.doggoFriend.Add(doggoFriend); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDoggoFriend", new { id = doggoFriend.DoggoFriendId }, doggoFriend)); }
public async Task <IActionResult> PutDoggoFriend(int id, DoggoFriend doggoFriend) { if (id != doggoFriend.DoggoFriendId) { return(BadRequest()); } _context.Entry(doggoFriend).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DoggoFriendExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }