public OrderService(IManager <Order> orderRepo, IManager <DeliveryMethod> deliveryRepo, IManager <Product> productRepo, IBasketManager basketRepo)
 {
     _basketRepo   = basketRepo;
     _productRepo  = productRepo;
     _deliveryRepo = deliveryRepo;
     _orderRepo    = orderRepo;
 }
 /// <summary>
 /// brings in contexts
 /// </summary>
 /// <param name="context">the shop db context</param>
 /// <param name="emailSender">the email sender context</param>
 /// <param name="basket">the basket context</param>
 public CheckoutService(MyShopDbContext context, IEmailSender emailSender, IBasketManager basket, IInventoryManager product)
 {
     _basket      = basket;
     _emailSender = emailSender;
     _shop        = context;
     _product     = product;
 }
 public AccountController(UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, IBasketManager context, IEmailSender emailSender)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _context       = context;
     _emailSender   = emailSender;
 }
 // Injecting context and managers
 public UsersController(UserManager <ApplicationUser> userManager,
                        SignInManager <ApplicationUser> signInManager, IBasketManager bsktManager, IEmailSender emailSender)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _bsktManager   = bsktManager;
     _emailSender   = emailSender;
 }
 /// <summary>
 /// Creates a new ShopController instance.
 /// </summary>
 /// <param name="invManager">The controller's inventory manager.</param>
 public ShopController(IInventoryManager invManager, UserManager <ApplicationUser> userManager,
                       IBasketManager bsktManager, SignInManager <ApplicationUser> signInManager)
 {
     _invManager    = invManager;
     _bsktManager   = bsktManager;
     _signInManager = signInManager;
     _userManager   = userManager;
 }
Beispiel #6
0
 /// <summary>
 /// Bring in contexts
 /// </summary>
 /// <param name="userManager">usr manager context</param>
 /// <param name="context">applicationuser db context for users</param>
 /// <param name="product">product db context for product information</param>
 /// <param name="checkout">brings in the checkout context and methods</param>
 /// <param name="configuration">brings in user secret data</param>
 public CheckoutController(UserManager <ApplicationUser> userManager, IBasketManager context, IInventoryManager product, ICheckoutManager checkout, IConfiguration configuration)
 {
     _userManager  = userManager;
     _context      = context;
     _product      = product;
     _checkout     = checkout;
     Configuration = configuration;
 }
Beispiel #7
0
 public ManagerController(IBasketManager _bskMngr, IProductManager _prdMngr,
                          IOrderManager _ordrMngr, IWebHostEnvironment environment)
 {
     hostingEnvironment = environment;
     bskMngr            = _bskMngr;
     prdMngr            = _prdMngr;
     ordrMngr           = _ordrMngr;
 }
Beispiel #8
0
 /// <summary>
 /// Initializes the controller with the required services.
 /// </summary>
 /// <param name="ordManager">The order service</param>
 /// <param name="bsktManager">The basket service</param>
 /// <param name="userManager">The user manager</param>
 public CheckoutController(IOrderManager ordManager, IBasketManager bsktManager,
                           UserManager <ApplicationUser> userManager, IEmailSender emailSender, IConfiguration configuration)
 {
     _ordManager   = ordManager;
     _bsktManager  = bsktManager;
     _userManager  = userManager;
     _emailSender  = emailSender;
     Configuration = configuration;
 }
Beispiel #9
0
 public CheckoutController(IOrderManager orderManager, IOrderItemManager orderItemManager, IBasketManager basketManager, IBasketItemManager basketItemManager, IEmailSender emailSender, IHostingEnvironment environment, IConfiguration configuration)
 {
     _orderItemManager  = orderItemManager;
     _orderManager      = orderManager;
     _basketItemManager = basketItemManager;
     _basketManager     = basketManager;
     _emailSender       = emailSender;
     _environment       = environment;
     _configuration     = configuration;
 }
Beispiel #10
0
 public HomeController(ILogger <HomeController> logger, EagroDbContext db, IBasketManager bskMng,
                       IOrderManager ordrMng, IProductManager prdMng, ICustomerManager cstMng)
 {
     _logger  = logger;
     _db      = db;
     _bskMng  = bskMng;
     _ordrMng = ordrMng;
     _prdMng  = prdMng;
     _cstMng  = cstMng;
 }
Beispiel #11
0
 public OrdersController(IOrderService orderService, IMapper mapper, IBasketManager basketManager)
 {
     _orderService  = orderService;
     _mapper        = mapper;
     _basketManager = basketManager;
 }
        public override void Display()
        {
            base.Display();

            if (GoodData.Instance.Goods.Count == 0)
            {
                Output.WriteLine("");
                Output.WriteLine(ConsoleColor.White, "No good added. Please add goods.");
            }
            else
            {
                basketManager = new BasketManager(GoodData.Instance);
                Output.WriteLine(ConsoleColor.White, "Start to add items in your basket. Insert 0 to close your basket.");
                string item = "";

                while (item != "0")
                {
                    item = Input.ReadString("Please enter your next item");
                    if (item != "0")
                    {
                        bool insert = basketManager.AddNewItem(item.ToUpper(), 1);
                        if (!insert)
                        {
                            Output.WriteLine("\tThis item can't be added to your basket!");
                        }
                    }
                }

                if (basketManager.BasketDetails.BasketList.Count > 0)
                {
                    Output.WriteLine("");
                    Output.WriteLine(ConsoleColor.White, "Ticket");
                    Output.WriteLine(ConsoleColor.White, "-----------");
                    Output.WriteLine("");

                    Output.WriteLine($"Item\tQty\tYour price");
                    foreach (BasketItem itm in basketManager.BasketDetails.Ticket)
                    {
                        if (itm.IsOffer)
                        {
                            Output.WriteLine(ConsoleColor.DarkCyan, $"{itm.Item}\t{itm.Quantity} x £{itm.Price}\t£{itm.FinalPrice}");
                        }
                        else
                        {
                            Output.WriteLine(ConsoleColor.DarkGray, $"{itm.Item}\t{itm.Quantity} x £{itm.Price}\t£{itm.FinalPrice}");
                        }
                    }
                    Output.WriteLine("");
                    Output.WriteLine(ConsoleColor.Gray, "-----------");
                    Output.WriteLine(ConsoleColor.Gray, $"Total: £{basketManager.GetTotalBasket()}");

                    Output.WriteLine("");
                    Output.WriteLine(ConsoleColor.Gray, "Your basket");
                    Output.WriteLine(ConsoleColor.Gray, "-----------");
                    Output.WriteLine("");

                    Output.WriteLine($"Item\tQty\tPrice\tYour price");
                    foreach (BasketItem itm in basketManager.BasketDetails.BasketList)
                    {
                        Output.WriteLine(ConsoleColor.DarkGray, $"{itm.Item}\t{itm.Quantity}\t£{itm.Price}\t£{itm.FinalPrice}");
                    }
                    Output.WriteLine("");
                    Output.WriteLine(ConsoleColor.Gray, "-----------");
                    Output.WriteLine(ConsoleColor.Gray, $"Total: £{basketManager.GetTotalBasket()}");

                    if (basketManager.BasketDetails.BasketHistory.Count > 0)
                    {
                        Output.WriteLine("");
                        Output.WriteLine("");

                        Output.WriteLine(ConsoleColor.Gray, "Basket history");
                        Output.WriteLine(ConsoleColor.Gray, "--------------");

                        Output.WriteLine($"Item\tPrice\tTotal\tOffer\tOperation");
                        foreach (History itm in basketManager.BasketDetails.BasketHistory)
                        {
                            Output.WriteLine(ConsoleColor.DarkGray, $"{itm.ItemName}\t£{itm.Price}\t£{itm.FinalPrice}\t{itm.ApplyDiscount}\t{itm.Operation}");
                        }
                    }

                    Output.WriteLine("");
                    Repository.BasketDetailsRepository repo = new Repository.BasketDetailsRepository();
                    string filename = FileData.BasketDetailsFile(DateTime.Now.ToString("yyyyMMddHHmmssfff"));
                    if (repo.SaveDetails(filename, basketManager.BasketDetails))
                    {
                        Output.WriteLine(ConsoleColor.DarkGray, "This basket is saved on");
                        Output.WriteLine(ConsoleColor.DarkGray, filename);
                    }
                    else
                    {
                        Output.WriteLine(ConsoleColor.Red, "I can't save the basket in a file!");
                    }
                }
                else
                {
                    Output.WriteLine("No items added to your basket.");
                }
            }
            Output.WriteLine("");

            Input.ReadString("Press [Enter] to navigate back");
            Program.NavigateBack();
        }
 public Payment(IConfiguration configuration, IBasketManager basket)
 {
     _basket       = basket;
     Configuration = configuration;
 }
 /// <summary>
 /// bring in context
 /// </summary>
 /// <param name="context">database</param>
 public ShopController(IInventoryManager context, IBasketManager basket)
 {
     _context = context;
     _basket  = basket;
 }
 public OrderDetailsController(IBasketManager basketManager)
 {
     _basketManager = basketManager;
 }
Beispiel #16
0
 public BasketController(IBasketManager context, UserManager <ApplicationUser> userManager, IInventoryManager productContext)
 {
     _context        = context;
     _userManager    = userManager;
     _productContext = productContext;
 }
 public void Setup()
 {
     priceCalculator = new Mock<IPriceCalculator>();
     productRepository = new Mock<IProductRepository>();
     basketManager = new BasketManager(priceCalculator.Object, productRepository.Object);
 }
 public BasketController(IBasketManager basketManager, IMapper mapper)
 {
     _mapper        = mapper;
     _basketManager = basketManager;
 }
Beispiel #19
0
 public BasketController(IBasketManager basketManager)
 {
     this.basketManager = basketManager;
 }
Beispiel #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BasketController"/> class.
 /// </summary>
 /// <param name="basketmgr">The basketmgr.</param>
 public BasketController(IBasketManager basketmgr)
 {
     this.basketMgr = basketmgr;
 }
Beispiel #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StoreController"/> class.
 /// </summary>
 /// <param name="basketMgr">The basket MGR.</param>
 public StoreController(IBasketManager basketMgr)
 {
     basketManager = basketMgr;
 }
Beispiel #22
0
 public BasketController(IBasketManager basketManager, ILogger <BasketController> logger)
 {
     manager     = basketManager;
     this.logger = logger;
 }
 // Constructor
 public BasketController(IBasketManager basketManager, IBasketItemManager basketItemManager, SignInManager <User> signInManager)
 {
     _basketManager     = basketManager;
     _basketItemManager = basketItemManager;
     _signInManager     = signInManager;
 }
Beispiel #24
0
 public BasketController(ISessionModel sessionModel, IBasketManager basketManager, ICheckoutManager checkoutManager)
 {
     _basketManager   = basketManager;
     _sessionModel    = sessionModel;
     _checkoutManager = checkoutManager;
 }
Beispiel #25
0
 public OrderController(IUnitOfWork unitOfWork, IMapper mapper, IBasketManager basketManager)
 {
     _unitOfWork    = unitOfWork;
     _mapper        = mapper;
     _basketManager = basketManager;
 }
Beispiel #26
0
 public BasketService()
 {
     basketMng = new BasketManager();
 }
Beispiel #27
0
 public BasketComponent(IBasketManager basketManager, IBasketItemManager basketItemManager)
 {
     _basketManager     = basketManager;
     _basketItemManager = basketItemManager;
 }
 public BasketController(ILogger <BasketController> logger, IBasketManager basketManager)
 {
     _logger        = logger;
     _basketManager = basketManager;
 }