public void Save(AuctionJson json) { if (!authorization.IsAuthorized()) { throw new WebFaultException(HttpStatusCode.Unauthorized); } // TODO: walidacja Auction auction = json.ToAuction(auctionRepository, true, true); auction.Owner = userRepository.Find(authorization.UserId); auction.CreationDate = DateTime.Now; foreach (var productsIds in json.ProductsIds) { Product product = productRepository.Find(productsIds); if (product == null) { throw new WebFaultException(HttpStatusCode.NotFound); } auction.Products.Add(product); } auctionRepository.Save(auction); }
public AuctionDetails(string auctionId) { InitializeComponent(); _auctionServiceClient = new AuctionServiceClient("AuctionEndpoint"); auction = _auctionServiceClient.Get(auctionId); DataContext = auction; }
public void Save(AuctionJson json) { using (new OperationContextScope(InnerChannel)) { var context = WebOperationContext.Current; Debug.Assert(context != null, "context != null"); Session.GetInstance.ApplyHeaders(context.OutgoingRequest.Headers); Channel.Save(json); } }