public IActionResult AddBuyer(int productId) { string UserID = User.GetUserIdToken(); var model = _buyerRepository.GetByCondition(a => a.UserId == UserID && a.UserProductId == productId); if (model.Count() == 0) { _buyerRepository.Add(new Buys() { UserId = UserID, IsSold = false, UserProductId = productId }); _buyerRepository.SaveAll(); return(Ok()); } return(NoContent()); }