public async Task <IHttpActionResult> AddFriend(int userID, int friendID) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var user = await db.Users.FirstOrDefaultAsync((u) => u.UserID == userID); if (user == null) { return(BadRequest()); } var friend = await db.Users.FirstOrDefaultAsync((u) => u.UserID == friendID); if (friend == null) { return(BadRequest()); } await db.AddAFriend(userID, friendID); return(Ok()); }