示例#1
0
        public IActionResult Index(int customerId)
        {
            string username = this.HttpContext.Session.GetString(SessionConstant.UserNameSession);

            if (string.IsNullOrEmpty(username))
            {
                return(RedirectToAction("Login", "Account"));
            }

            var salesTransactionViewModel = new SalesTransactionVievModel();
            var customer = this._customerRepository.GetCustomerById(customerId);

            if (customer == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var products        = this._productRepository.GetProductsAvailable();
            var addedProducLine = this._tempTransRepository.GetAddedSalesLines(customerId);

            ViewData["AddedSalesLine"] = addedProducLine;
            ViewData["CustomerId"]     = customerId;
            ViewData["Products"]       = products;
            return(View(salesTransactionViewModel));
        }
示例#2
0
        public IActionResult ExistingCustomer(AddNewViewModel model)
        {
            string username = this.HttpContext.Session.GetString(SessionConstant.UserNameSession);

            if (string.IsNullOrEmpty(username))
            {
                return(RedirectToAction("Login", "Account"));
            }

            var salesTransactionViewModel = new SalesTransactionVievModel();
            var customer = this._customerRepository.GetCustomerById(model.ExistingCustomerId);

            if (customer == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(RedirectToAction("Index", "SalesTransaction",
                                        new { customerId = model.ExistingCustomerId }));
            }
        }