public bool CreateAuction(WebAuction auctionToAdd)
        {
            bool allOk = false;

            proxyRef.Auction auctionServiceFormat = new TransformAuction().ConvertToServiceAuction(auctionToAdd);
            using (AuctionServiceClient auctionProxy = new AuctionServiceClient())
            {
                allOk = auctionProxy.AddAuction(auctionServiceFormat);
            }
            return(allOk);
        }
Ejemplo n.º 2
0
        // CONVERT SERVICE AUCTION LIST TO WEB LIST
        public List <WebAuction> ConvertFromServiceAuctions(proxyRef.Auction[] sAuctions)
        {
            List <WebAuction> foundClientAuctions = new List <WebAuction>();
            WebAuction        tempAuction         = null;

            foreach (proxyRef.Auction sAuction in sAuctions)
            {
                tempAuction = ConvertFromServiceAuction(sAuction);
                foundClientAuctions.Add(tempAuction);
            }
            return(foundClientAuctions);
        }
Ejemplo n.º 3
0
        public ActionResult Create(WebAuction auc)
        {
            WebAuctionService was = new WebAuctionService();

            auc.Result = "Open";
            DateTime dt = new DateTime(2012, 12, 31, 16, 45, 0);

            auc.PaymentDate = dt;
            auc.Payment     = false;

            was.CreateAuction(auc);

            return(RedirectToAction("List"));
        }
Ejemplo n.º 4
0
        // CONVERT WEB AUCTION TO SERVICE AUCTION
        public WebAuction ConvertFromServiceAuction(proxyRef.Auction sAuction)
        {
            WebAuction foundClientAuction = null;

            if (sAuction != null)
            {
                foundClientAuction = new WebAuction {
                    AuctionId          = sAuction.AuctionId,
                    TimeLeft           = sAuction.TimeLeft,
                    Payment            = sAuction.Payment,
                    Result             = sAuction.Result,
                    PaymentDate        = sAuction.PaymentDate,
                    ProductName        = sAuction.ProductName,
                    ProductDescription = sAuction.ProductDescription,
                };
            }
            return(foundClientAuction);
        }
Ejemplo n.º 5
0
        // CONVERT WEB MODEL AUCTION TO SERVICE AUCTION
        public proxyRef.Auction ConvertToServiceAuction(WebAuction webAuction)
        {
            proxyRef.Auction proxyWebAuction = null;
            if (webAuction != null)
            {
                proxyWebAuction = new proxyRef.Auction
                {
                    AuctionId          = webAuction.AuctionId,
                    TimeLeft           = webAuction.TimeLeft,
                    Payment            = webAuction.Payment,
                    Result             = webAuction.Result,
                    PaymentDate        = webAuction.PaymentDate,
                    ProductName        = webAuction.ProductName,
                    ProductDescription = webAuction.ProductDescription,
                };
            }

            return(proxyWebAuction);
        }