Example #1
0
        public ActionResult Refund_Old()
        {
            List <TransactionViewModel> list      = new OfferService().Refund();
            TransactionViewModel        dummyData = new TransactionViewModel();

            if (list.Count == 0)
            {
                dummyData.count  = "0";
                dummyData.laonId = "0";

                TransactionViewModel.Transactions temp = new TransactionViewModel.Transactions();
                temp.parentTransactionId = "0";
                temp.transactionAmount   = "0";
                temp.transactionDate     = "No date found";
                temp.transactionType     = "No TYPE";
                temp.transactionId       = "No Id";
                temp.transactionError    = "No Transaction Found";
                temp.transactionStatus   = "No Transaction Performed";
                dummyData.transactions   = temp;

                list.Add(dummyData);
                return(View(list));
            }



            return(View(list));
        }
Example #2
0
 // POST: api/Offer
 public IHttpActionResult Post(Offer newOffer)
 {
     if (ModelState.IsValid)
     {
         return(Ok(offerService.Add(newOffer)));
     }
     else
     {
         return(BadRequest());
     }
 }
Example #3
0
        public IHttpActionResult Test()
        {
            try
            {
                Buyer buyer1 = new Buyer();
                buyer1.Email = "*****@*****.**";
                buyer1.Name  = "Pablo";
                buyer1.Phone = "123456789";
                Buyer buyer2 = new Buyer();
                buyer2.Email = "*****@*****.**";
                buyer2.Name  = "Pablo U.";
                buyer2.Phone = "897654123";
                Buyer buyer3 = new Buyer();
                buyer3.Email = "*****@*****.**";
                buyer3.Name  = "Luis";
                buyer3.Phone = "22233666";
                BuyerService buyerService = new BuyerService();
                buyerService.Add(buyer1);
                buyerService.Add(buyer2);
                buyerService.Add(buyer3);

                Seller seller1 = new Seller();
                seller1.Email = "*****@*****.**";
                seller1.Name  = "Diego";
                seller1.Phone = "456666";
                Seller seller2 = new Seller();
                seller2.Email = "*****@*****.**";
                seller2.Name  = "Godin";
                seller2.Phone = "357159";
                Seller seller3 = new Seller();
                seller3.Email = "*****@*****.**";
                seller3.Name  = "Carlitos";
                seller3.Phone = "5254";
                SellerService sellerService = new SellerService();
                sellerService.Add(seller1);
                sellerService.Add(seller2);
                sellerService.Add(seller3);


                Publication publication = new Publication();
                publication.IdBuyer         = 1;
                publication.Buyer           = buyer1;
                publication.Description     = "Computador I7";
                publication.DescriptionItem = "Compu I7";
                publication.Price           = 1200;
                publication.PriceMinItem    = 800;
                publication.PriceMaxItem    = 1200;

                publicationService.Add(publication);

                Publication publication2 = new Publication();
                publication2.IdBuyer         = 1;
                publication2.Buyer           = buyer1;
                publication2.Description     = "Computador I5";
                publication2.DescriptionItem = "Compu I5";
                publication2.Price           = 1000;
                publication2.PriceMinItem    = 500;
                publication2.PriceMaxItem    = 1000;

                publicationService.Add(publication2);


                Publication publication3 = new Publication();
                publication3.IdBuyer         = 1;
                publication3.Buyer           = buyer1;
                publication3.Description     = "Computador I3";
                publication3.DescriptionItem = "Compu I3";
                publication3.Price           = 800;
                publication3.PriceMinItem    = 500;
                publication3.PriceMaxItem    = 800;

                publicationService.Add(publication3);

                Offer offer1 = new Offer();
                offer1.IdPublication   = 1;
                offer1.IdSeller        = 1;
                offer1.DescriptionItem = "Una compu I7";
                offer1.PriceItem       = 1100;


                Offer offer2 = new Offer();
                offer2.IdPublication   = 1;
                offer2.IdSeller        = 2;
                offer2.DescriptionItem = "Una compu I7";
                offer2.PriceItem       = 1150;

                Offer offer3 = new Offer();
                offer3.IdPublication   = 2;
                offer3.IdSeller        = 3;
                offer3.DescriptionItem = "Una compu I5";
                offer3.PriceItem       = 900;


                OfferService offerService = new OfferService();
                offerService.Add(offer1);
                offerService.Add(offer2);
                offerService.Add(offer3);


                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }