// GET: Customer
        public ActionResult Index()
        {
            var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            var user   = _context.Users.Where(x => x.Id == userId).SingleOrDefault();

            try
            {
                var customer = _context.Customers.Where(x => x.Id == user.Id).SingleOrDefault();
                var customerDashBoardViewModel = new CustomerDashboardViewModel();
                customerDashBoardViewModel.Customer = customer;
                var daysList = _context.Days.ToList();
                customerDashBoardViewModel.DaysOfWeek              = new SelectList(daysList, "DayId", "DayOfWeek");
                customerDashBoardViewModel.DayOfWeek               = _context.Days.Where(x => x.DayId == customer.DayId).Select(x => x.DayOfWeek).FirstOrDefault();
                customerDashBoardViewModel.Street                  = _context.Addresses.Where(x => x.AddressId == customer.AddressId).Select(x => x.Street).FirstOrDefault();
                customerDashBoardViewModel.City                    = _context.Addresses.Where(x => x.AddressId == customer.AddressId).Select(x => x.City).FirstOrDefault();
                customerDashBoardViewModel.State                   = _context.Addresses.Where(x => x.AddressId == customer.AddressId).Select(x => x.State).FirstOrDefault();
                customerDashBoardViewModel.Zip                     = _context.Addresses.Where(x => x.AddressId == customer.AddressId).Select(x => x.Zip).FirstOrDefault();
                customerDashBoardViewModel.AccountBalance          = _context.Accounts.Where(x => x.AccountId == customer.AccountId).Select(x => x.Balance).FirstOrDefault();
                customerDashBoardViewModel.AccountBalanceFormatted = customerDashBoardViewModel.AccountBalance.ToString("C2");
                return(View(customerDashBoardViewModel));
            }
            catch
            {
                return(RedirectToAction(nameof(FirstTimeSetup)));
            }
        }
        public ActionResult RequestSpecialPickupDate(CustomerDashboardViewModel thisCustomer)
        {
            var userId   = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            var customer = _context.Customers.Where(x => x.Id == userId).SingleOrDefault();

            customer.SpecialPickup = thisCustomer.SpecialPickup;
            _context.SaveChanges();
            return(RedirectToAction(nameof(Index)));
        }
        public ActionResult SuspendServices(CustomerDashboardViewModel thisCustomer)
        {
            var userId   = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            var customer = _context.Customers.Where(x => x.Id == userId).SingleOrDefault();

            customer.SuspendStart = thisCustomer.SuspendStart;
            customer.SuspendEnd   = thisCustomer.SuspendEnd;
            _context.SaveChanges();
            return(RedirectToAction(nameof(Index)));
        }
        public ActionResult UpdateDay(CustomerDashboardViewModel thisCustomer)
        {
            var userId         = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            var customer       = _context.Customers.Where(x => x.Id == userId).SingleOrDefault();
            var customersDayId = _context.Days.Where(x => x.DayOfWeek == thisCustomer.SelectedDay).Select(x => x.DayId).SingleOrDefault();

            customer.DayId = customersDayId;
            _context.SaveChanges();
            return(RedirectToAction(nameof(Index)));
        }
        // GET: Customer/Dashboard
        public ActionResult Index()
        {
            var customer = _customerRepo.GetCurrentCustomer();
            var invoices = _invoiceRepo.GetCustomerInvoices(customer.Id);
            var vm       = new CustomerDashboardViewModel()
            {
                Customer = customer,
                Invoices = invoices
            };

            return(View(vm));
        }
Beispiel #6
0
        // GET: CustomerManagement
        public ActionResult Index()
        {
            CustomerDashboardViewModel customerDashboardViewModel = new CustomerDashboardViewModel();

            try
            {
                var userDetails = (CustomerLoginDetail)Session["UserSession"];
                userDetails.CustomerName = "";
                customerDashboardViewModel.onBoardingListings = OBR.GetOnBoardingListings(userDetails);
                customerDashboardViewModel.customerListings   = CR.GetAllCustomer();
            }
            catch (Exception ex)
            {
                newexception.AddException(ex, "");
            }
            return(View(customerDashboardViewModel));
        }