Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public AuctionDetails(string auctionId)
        {
            InitializeComponent();

            _auctionServiceClient = new AuctionServiceClient("AuctionEndpoint");
            auction = _auctionServiceClient.Get(auctionId);

            DataContext = auction;
        }
Ejemplo n.º 3
0
        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);
            }
        }