public ActionResult Index()
        {
            var model = new HomeViewData();

            model.Nome = "PAGINA DE HOME CRIAR ...";
            return(View(model));
        }
        public async Task <HomeViewModel> GetHomeViewModelAsync(string studentId)
        {
            StudentDTO student = await studentService.GetByIdAsyncWithMentorSubmissionsFilesAndAssignmentFile(studentId);

            var           pageData  = new HomeViewData(student);
            HomeViewModel viewModel = viewFactory.CreateView <HomeViewData, HomeViewModel>(pageData);

            return(viewModel);
        }
示例#3
0
        public async Task <MentorsHomeViewModel> GetHomeViewModelAsync(string mentorId)
        {
            MentorDTO mentor = await mentorService.GetByIdWithStudentsAndAssignmentsAsync(mentorId);

            var viewModelData = new HomeViewData(mentor);
            MentorsHomeViewModel viewModel = viewFactory.CreateView <HomeViewData, MentorsHomeViewModel>(viewModelData);

            return(viewModel);
        }
示例#4
0
        public ActionResult Index()
        {
            // user is logged in
            var user = repository.GetUserById(sessionid.Value, subdomainid.Value);

            // check if account has been setup properly
            if (role.HasFlag(UserRole.CREATOR) && !MASTERdomain.currency.HasValue)
            {
                return(RedirectToAction("setup", "register", new { Area = "" }));
            }

            var activityGroups = new ActivityGroup
            {
                tradelr = new TradelrActivity()
                {
                    filterList =
                        typeof(ActivityType).ToSelectList().ToFilterList()
                }
            };

            if (role.HasFlag(UserRole.CREATOR))
            {
                // for admin
                // tradelr activity
                activityGroups.tradelr.activities = repository.GetActivities(subdomainid.Value)
                                                    .OrderByDescending(x => x.id)
                                                    .ToAdminList(sessionid.Value)
                                                    .Take(GeneralConstants.ACTIVITY_ROWS_PER_PAGE)
                                                    .ToModel();
            }
            else
            {
                // for user
                activityGroups.tradelr.activities =
                    repository.GetActivities(subdomainid.Value)
                    .OrderByDescending(x => x.id)
                    .ToUserList(sessionid.Value)
                    .Take(GeneralConstants.ACTIVITY_ROWS_PER_PAGE)
                    .ToModel();
            }


            // handle statistics
            if (role == UserRole.USER)
            {
                // show account stats
                Statistics statistics = null;
                if (baseviewmodel.permission.HasFlag(UserPermission.NETWORK_STORE | UserPermission.TRANSACTION_VIEW | UserPermission.INVENTORY_VIEW))
                {
                    var analytics = new GoogleAnalytics();
                    analytics.GetVisitorStatistics(accountHostname, DateTime.UtcNow.AddMonths(-1), DateTime.UtcNow);
                    statistics = new Statistics(analytics.stats, DateTime.UtcNow.AddMonths(-1), DateTime.UtcNow);
                    statistics.InitSalesAndProductsStatistics(repository, subdomainid.Value, sessionid.Value,
                                                              user.organisation1.MASTERsubdomain);
                }

                // this is for scenario where user is not registered but someone has send them
                // an invoice or purchase order
                var home = new HomeViewData(baseviewmodel)
                {
                    activities = activityGroups,
                    isAdmin    = false,
                    stats      = statistics
                };

                return(View(home));
            }
            else // for admins, god and staff
            {
                // which activity panel?
                var paneltype = repository.GetActivityPanel(sessionid.Value);

                var analytics = new GoogleAnalytics();
                analytics.GetVisitorStatistics(accountHostname, DateTime.UtcNow.AddMonths(-1), DateTime.UtcNow);
                var statistics = new Statistics(analytics.stats, DateTime.UtcNow.AddMonths(-1), DateTime.UtcNow);
                statistics.InitSalesAndProductsStatistics(repository, subdomainid.Value, sessionid.Value,
                                                          user.organisation1.MASTERsubdomain);

                var home = new HomeViewData(baseviewmodel)
                {
                    stats      = statistics, // from baseController
                    activities = activityGroups,
                    panelIndex = paneltype.ToIndex(),
                    isAdmin    = true
                };

                return(View(home));
            }
        }