public async Task <IActionResult> DeletePickupBid([FromBody] PickupBidDeleteRequest request) { if (!ModelState.IsValid) { return(BadRequest()); } var maybeBid = await _fantasyCriticService.GetPickupBid(request.BidID); if (maybeBid.HasNoValue) { return(BadRequest("That bid does not exist.")); } var publisher = maybeBid.Value.Publisher; var currentUser = await _userManager.FindByNameAsync(User.Identity.Name); bool userIsInLeague = await _fantasyCriticService.UserIsInLeague(publisher.League, currentUser); bool userIsPublisher = (currentUser.UserID == publisher.User.UserID); if (!userIsInLeague || !userIsPublisher) { return(Forbid()); } PickupBid bid = maybeBid.Value; Result result = await _fantasyCriticService.RemovePickupBid(bid); if (result.IsFailure) { return(BadRequest(result.Error)); } return(Ok()); }