Exemplo n.º 1
0
        public IActionResult Buy(PurchaseViewModel model)
        {
            BuyService service = new BuyService(Data.Data.Context);

            service.AddPurchise(model);
            return(this.View("Home", "Index"));
        }
Exemplo n.º 2
0
        public async Task <IEnumerable <Order> > GetDiscountAsync()
        {
            BuyService          b = new BuyService(10);
            IEnumerable <Order> g = await GetAllAsync();

            return(b.GetDiscount(g, 0));
        }
        public IEnumerable <Order> GetDiscount()
        {
            BuyService          b = new BuyService(10);
            IEnumerable <Order> g = GetAll();

            return(b.GetDiscount(g, 0));
        }
Exemplo n.º 4
0
        private BuyService CreateBuyPropertyService()
        {
            var userId             = Guid.Parse(User.Identity.GetUserId());
            var buyPropertyService = new BuyService(userId);

            return(buyPropertyService);
        }
Exemplo n.º 5
0
        public IHttpActionResult Get(int id)
        {
            BuyService buyService  = CreateBuyPropertyService();
            var        buyProperty = buyService.GetBuyPropertyById(id);

            return(Ok(buyProperty));
        }
Exemplo n.º 6
0
        public IHttpActionResult GetAllRealEstateProperty()
        {
            BuyService buyService  = CreateBuyPropertyService();
            var        buyProperty = buyService.GetBuyListItems();

            return(Ok(buyProperty));
        }
Exemplo n.º 7
0
        public IActionResult Buy(HttpResponse response, PurchaseBinding model)
        {
            var service = new BuyService(Data.Data.Context);

            service.AddPurchaseFromBind(model);
            this.Redirect(response, "/home/index");
            return(null);
        }
Exemplo n.º 8
0
        public IActionResult Buy(PurchaseBindingModel model, HttpResponse responce)
        {
            BuyService service = new BuyService(Data.Data.Context);

            service.AddPurchase(model);

            this.Redirect(responce, "/home/index");
            return(null);
        }
Exemplo n.º 9
0
        public void CalculatePrice_ShouldReturn_16_When_b1b1()
        {
            BuyService    target = new BuyService();
            List <string> card   = new List <string>()
            {
                "b1", "b1"
            };
            float expected = 16F;
            float actual;

            actual = target.CalculatePrice(card);
            actual.Should().Be(expected);
        }
Exemplo n.º 10
0
        public void CalculatePrice_ShouldReturn_51dot20_When_b1b2b2b3b3b4b5()
        {
            BuyService    target = new BuyService();
            List <string> card   = new List <string>()
            {
                "b1", "b1", "b2", "b2", "b3", "b3", "b4", "b5"
            };
            float expected = 51.2F;
            float actual;

            actual = target.CalculatePrice(card);
            actual.Should().Be(expected);
        }
Exemplo n.º 11
0
        public IActionResult <BuyKnifeViewModel> Buy(HttpResponse response, int knifeId)
        {
            var service = new BuyService(Data.Data.Context);

            if (!service.IsKnifeValid(knifeId))
            {
                this.Redirect(response, "/home/products?productName=");
                return(null);
            }

            return(View(new BuyKnifeViewModel
            {
                KnifeId = knifeId
            }));
        }
Exemplo n.º 12
0
        public IActionResult <IEnumerable <AllOrdersViewModel> > Orders(HttpResponse response, HttpSession session)
        {
            var user = AuthenticationManager.GetAuthenticatedUser(session.Id);

            if (user == null)
            {
                this.Redirect(response, "/login/login");
                return(null);
            }

            var service    = new BuyService(Data.Data.Context);
            var viewModels = service.GetPurchases();

            return(this.View(viewModels));
        }
Exemplo n.º 13
0
        public IActionResult <BuyKnifeViewModel> Buy(int knifeId, HttpResponse response)
        {
            BuyService service = new BuyService(Data.Data.Context);

            if (!service.IsKnifeIdValid(knifeId))
            {
                this.Redirect(response, "/home/products");
                return(null);
            }

            return(this.View(new BuyKnifeViewModel()
            {
                KnifeId = knifeId
            }));
        }
Exemplo n.º 14
0
        static async Task Main(string[] args)
        {
            List <Task> services = new List <Task>
            {
                AddService.Main(args),
                BuyService.Main(args),
                BuyTriggerService.Main(args),
                DisplaySummaryService.Main(args),
                QuoteService.Main(args),
                SellService.Main(args),
                SellTriggerService.Main(args)
            };

            await Task.WhenAll(services);
        }
Exemplo n.º 15
0
 public RootController()
 {
     BuyService = new BuyService("C:\\Users\\48795\\RiderProjects\\BillShop\\BillShop\\Data\\ProductList.csv",
                                 "C:\\Users\\48795\\RiderProjects\\BillShop\\BillShop\\Data\\Discountcsv.csv");
 }