public void UpdateBid(Guid id, UpdateBid product) { Product productToUpdate = _repository.GetByFilter <Product>(p => p.Id == id); if (productToUpdate == null) { return; } productToUpdate.FinalPrice = product.FinalPrice; productToUpdate.WinnerId = product.WinnerId; if (product.Deadline >= DateTime.Today) { productToUpdate.Deadline = product.Deadline; } _repository.Update(productToUpdate); _repository.Save(); Wishlist wishlist = _repository.GetByFilter <Wishlist>(p => p.ProductId == id.ToString() && p.UserId == product.WinnerId); if (wishlist == null) { var newWish = new Wishlist { Id = Guid.NewGuid(), UserId = product.WinnerId, ProductId = id.ToString() }; _repository.Insert(newWish); _repository.Save(); } Recommendations recommendations = _repository.GetByFilter <Recommendations>(p => p.UserId == product.WinnerId && p.CategoryId == productToUpdate.CategoryId); if (recommendations == null) { var newBid = new Recommendations { Id = Guid.NewGuid(), CategoryId = productToUpdate.CategoryId, UserId = product.WinnerId, Bids = 0 }; _repository.Insert(newBid); _repository.Save(); } else { recommendations.Bids++; _repository.Update(recommendations); _repository.Save(); } }
private async void SetupHub() { _updateDelegate = new UpdateBid(UpdateBidMethod); _updateButtonsDelegate = new UpdateButtons(UpdateButtonsMethod); _hubConnection = new Microsoft.AspNet.SignalR.Client.HubConnection("http://localhost:1331/"); _auctionProxy = _hubConnection.CreateHubProxy("AuctionHub"); _auctionProxy.Subscribe("UpdateBid").Received += UpdateBid_auctionProxy; _auctionProxy.Subscribe("CloseBid").Received += CloseBid_auctionProxy; _auctionProxy.Subscribe("CloseBidWin").Received += CloseBidWin_auctionProxy; await _hubConnection.Start(); }
private async void SetupHub() { _updateDelegate = new UpdateBid(UpdateBidMethod); _updateButtonsDelegate = new UpdateButtons(UpdateButtonsMethod); _hubConnection = new HubConnection("http://192.168.1.148:1331/"); _auctionProxy = _hubConnection.CreateHubProxy("AuctionHub"); _auctionProxy.Subscribe("UpdateBid").Received += UpdateBid_auctionProxy; _auctionProxy.Subscribe("CloseBid").Received += CloseBid_auctionProxy; _auctionProxy.Subscribe("CloseBidWin").Received += CloseBidWin_auctionProxy; await _hubConnection.Start(); }
private async void SetupHub() { _updateDelegate = UpdateBidMethod; _updateButtonsDelegate = UpdateButtonsMethod; _hubConnection = new HubConnection("http://localhost:4558"); _auctionProxy = _hubConnection.CreateHubProxy("AuctionHub"); _auctionProxy.Subscribe("updateBid").Received += OnUpdateBid; _auctionProxy.Subscribe("CloseBid").Received += OnCloseBid; _auctionProxy.Subscribe("CloseBidWin").Received += OnCloseBidWin; await _hubConnection.Start().ConfigureAwait(false); }
public IActionResult UpdateBid([FromRoute] Guid id, [FromBody] UpdateBid productDto) { _productLogic.UpdateBid(id, productDto); return(NoContent()); }