Пример #1
0
        public ActionResult ViewEmployee(ViewModel input)
        {
            var employee    = _repository.Find <Employee>(input.EntityId);
            var url         = UrlContext.GetUrlForAction <EmployeeDashboardController>(x => x.PendingTasks(null)) + "?ParentId=" + input.EntityId;
            var completeUrl = UrlContext.GetUrlForAction <EmployeeDashboardController>(x => x.CompletedTasks(null)) + "?ParentId=" + input.EntityId;
            var model       = new EmployeeDashboardViewModel
            {
                //TODO put modficaztions here "Employee"
                Employee                = employee,
                AddEditUrl              = UrlContext.GetUrlForAction <TaskController>(x => x.AddEdit(null)) + "?ParentId=" + input.EntityId + "&From=Employee",
                ListDefinition          = _pendingTaskGrid.GetGridDefinition(url, WebLocalizationKeys.PENDING_TASKS),
                CompletedListDefinition = _completedTaskGrid.GetGridDefinition(completeUrl, WebLocalizationKeys.COMPLETED_TASKS),
            };

            return(View("EmployeeDashboard", model));
        }
        public ActionResult ViewField(ViewModel input)
        {
            var field = _repository.Find <Field>(input.EntityId);
            var url   = UrlContext.GetUrlForAction <FieldDashboardController>(x => x.PendingTasks(null)) + "?ParentId=" +
                        input.EntityId;
            var completeUrl = UrlContext.GetUrlForAction <FieldDashboardController>(x => x.CompletedTasks(null)) +
                              "?ParentId=" + input.EntityId + "&gridName=CompletedTaskGrid";
            var photoUrl = UrlContext.GetUrlForAction <FieldDashboardController>(x => x.Photos(null)) + "?ParentId=" +
                           input.EntityId + "&gridName=CompletedTaskGrid";
            var docuemntUrl = UrlContext.GetUrlForAction <FieldDashboardController>(x => x.Documents(null)) +
                              "?ParentId=" + input.EntityId + "&gridName=CompletedTaskGrid";
            var model = new FieldDashboardViewModel
            {
                EntityId   = input.EntityId,
                Field      = field,
                AddEditUrl =
                    UrlContext.GetUrlForAction <TaskController>(x => x.AddEdit(null)) + "?ParentId=" +
                    input.EntityId + "&From=Field",
                AddEditPhotoUrl =
                    UrlContext.GetUrlForAction <PhotoController>(x => x.AddUpdate(null)) + "?ParentId=" +
                    input.EntityId + "&From=Field",
                AddEditDocumentUrl =
                    UrlContext.GetUrlForAction <DocumentController>(x => x.AddUpdate(null)) + "?ParentId=" +
                    input.EntityId + "&From=Field",
                ListDefinition =
                    _pendingTaskGrid.GetGridDefinition(url, WebLocalizationKeys.PENDING_TASKS),
                CompletedListDefinition =
                    _completedTaskGrid.GetGridDefinition(completeUrl,
                                                         WebLocalizationKeys.COMPLETED_TASKS),
                DocumentListDefinition =
                    _documentListGrid.GetGridDefinition(docuemntUrl, WebLocalizationKeys.DOCUMENTS),
                PhotoListDefinition =
                    _photoListGrid.GetGridDefinition(photoUrl, WebLocalizationKeys.PHOTOS),
            };

            return(View("FieldDashboard", model));
        }