コード例 #1
0
        public ActionResult dashboard()
        {
            if ((Session["userId"] == null) || (Convert.ToInt32(Session["type"]) != 1))
            {
                return(RedirectToAction("login", "Common"));
            }

            DashboardViewModel DVM = new DashboardViewModel();

            DVM.customer = _CustomerService.GetById(Convert.ToInt32(Session["userId"]));

            DVM.ActiveRequests  = _RequestService.GetActiveByCustomer(Convert.ToInt32(Session["userId"]));
            DVM.PendingRequests = _RequestService.GetPendingByCustomer(Convert.ToInt32(Session["userId"]));
            int count = 0;

            foreach (var item in DVM.ActiveRequests)
            {
                DVM.ActiveRepairman[count] = _RepairmanService.GetById(item.RepairmanID);
                count++;
            }



            return(View(DVM));
        }
コード例 #2
0
        public ActionResult viewprofilecustomer(int id)
        {
            if ((Session["userId"] == null) || (Convert.ToInt32(Session["type"]) != 3))
            {
                return(RedirectToAction("login", "Common"));
            }

            ViewProfileCustomerViewModel VPCVM = new ViewProfileCustomerViewModel();

            VPCVM.admin = _AdminService.GetById(Convert.ToInt32(Session["userId"]));

            VPCVM.customer  = _CustomerService.GetById(id);
            VPCVM.completed = _RequestService.GetCompletedByCustomer(id).Count();
            VPCVM.pending   = _RequestService.GetPendingByCustomer(id).Count();
            VPCVM.requests  = _RequestService.GetAllCustomer(id);
            int count = 0;

            foreach (var item in VPCVM.requests)
            {
                VPCVM.repairmen[count] = _RepairmanService.GetById(item.RepairmanID);
                count++;
            }

            return(View(VPCVM));
        }
コード例 #3
0
        public ActionResult dashboard()
        {
            if ((Session["userId"] == null) || (Convert.ToInt32(Session["type"]) != 2))
            {
                return(RedirectToAction("login", "Common"));
            }

            DashboardViewModel DVM = new DashboardViewModel();

            DVM.repairman = _RepairmanService.GetById(Convert.ToInt32(Session["userId"]));
            DVM.request   = _RequestService.GetActiveByRepairman(DVM.repairman.RepairmanID);
            if (DVM.request != null)
            {
                DVM.customer = _CustomerService.GetById(DVM.request.CustomerID);
            }

            return(View(DVM));
        }