Exemple #1
0
        public IActionResult DistributerPayment()
        {
            var userId      = _userManager.GetUserId(HttpContext.User);
            var distributer = _disService.GetByUserId(userId);
            var model       = _disService.GetPayments(distributer.Id);

            return(View(model));
        }
Exemple #2
0
        public async Task <IActionResult> Index()
        {
            var user = await _userManager.GetUserAsync(HttpContext.User);

            string cartSession = HttpContext.Session.GetString("Cart");

            if (cartSession == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            var cart = JsonConvert.DeserializeObject <Cart>(HttpContext.Session.GetString("Cart"));

            CheckoutAddModel model;

            if (await _userManager.IsInRoleAsync(user, "Dealer"))
            {
                var dealer = _dealerService.GetByUserId(user.Id);
                model = new CheckoutAddModel
                {
                    PersonName      = dealer.FirstName + " " + dealer.LastName,
                    Contact         = dealer.Telephone,
                    ShippingAddress = dealer.Address + "," + dealer.City,
                    Cart            = cart
                };
                return(View(model));
            }
            if (await _userManager.IsInRoleAsync(user, "Distributer"))
            {
                var distributer = _disService.GetByUserId(user.Id);
                model = new CheckoutAddModel
                {
                    PersonName      = distributer.FirstName + " " + distributer.LastName,
                    Contact         = distributer.Telephone,
                    ShippingAddress = distributer.Address + "," + distributer.City,
                    Cart            = cart
                };
                return(View(model));
            }
            return(NotFound());
        }