public IActionResult ApproveOrDeclineOffer([FromBody] OfferUpdateModel offerReceived) { var offer = _offerRepository.GetOfferByOfferId(offerReceived.OfferId); var product = _productRepository.GetProductById(offerReceived.ProductId); var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); if (offer != null && product != null) { if (product.OwnerId.Equals(userId)) { if (offerReceived.Message.Equals("Approve")) { _offerRepository.AcceptOffer(offer, offerReceived); return(Json(new { success = "true" })); } else if (offerReceived.Message.Equals("Decline")) { _offerRepository.DeclineOffer(offer, offerReceived); return(Json(new { success = "true" })); } return(Json(new { success = "false" })); } } return(Json(new { success = "false" }));; }