예제 #1
0
        public async Task <ActionResult> Delegate()
        {
            int departmentId = Convert.ToInt32(RouteData.Values["departmentId"]);

            Task <User>                representativeTask   = UserDao.GetRepresentative(departmentId);
            Task <List <User> >        allEmployeesTask     = UserDao.GetAllEmployeesFromDepartment(departmentId);
            Task <User>                temporaryHeadTask    = UserDao.GetTemporaryHeadByDepartment(departmentId);
            Task <List <PickUpPoint> > pickUpPointsTask     = PickUpPointDao.GetAllPickupPoints();
            Task <PickUpPoint>         getCurrentPickupTask = PickUpPointDao.GetPickupPointByDepartment(departmentId);

            User               user          = await representativeTask;
            List <User>        users         = await allEmployeesTask;
            User               temporaryHead = await temporaryHeadTask;
            List <PickUpPoint> points        = await pickUpPointsTask;
            PickUpPoint        point         = await getCurrentPickupTask;

            ViewData["Employees"]             = users;
            ViewData["CurrentRepresentative"] = user;
            ViewData["TemporaryHead"]         = temporaryHead;
            ViewData["PickUpPoints"]          = points;
            ViewData["CurrentPickUpPoint"]    = point;
            return(View("Index"));
        }
        public async Task <ActionResult> PickUpPointMobile()
        {
            List <object> result = new List <object>();
            int           rank   = Convert.ToInt32(RouteData.Values["rank"]);

            if (rank == 0 || rank == 5)
            {
                int departmentId = Convert.ToInt32(RouteData.Values["departmentId"]);
                Task <List <PickUpPoint> > pickUpPointsTask     = PickUpPointDao.GetAllPickupPoints();
                Task <PickUpPoint>         getCurrentPickupTask = PickUpPointDao.GetPickupPointByDepartment(departmentId);
                List <PickUpPoint>         points = await pickUpPointsTask;
                PickUpPoint point = await getCurrentPickupTask;
                points.Add(point);


                return(Json(points, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var failAuth = new { result = 0 };
                result.Add(failAuth);
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }