Example #1
0
        public ActionResult List()
        {
            var applyJobs = applyJobService.GetApplyJobs().Select(x => new ApplyJobModel
            {
                Id        = x.Id,
                FullName  = x.FullName,
                Email     = x.Email,
                IsActive  = x.IsActive,
                ApplyDate = x.ApplyDateUtc,
                IsRead    = x.IsRead,
                Message   = x.Message,
                Phone     = x.Phone,
                Website   = x.Website,
                JobId     = x.JobId,
                JobName   = jobService.GetById(x.JobId).Title
            }).ToList();

            return(View(new GridModel <ApplyJobModel>
            {
                Data = applyJobs,
                Total = applyJobs.Count()
            }));
        }
Example #2
0
        public ActionResult Index()
        {
            int takeCount = 5;

            var users = userService.Users.ToList().Select(x => new ApplicationUserModel
            {
                Id             = x.Id,
                UserName       = x.UserName,
                Email          = x.Email,
                EmailConfirmed = x.EmailConfirmed,
                IsActive       = x.IsActive,
                AvatarId       = x.PictureId,
                AvatarUrl      = mediaStorageService.GetPictureUrl(x.PictureId),
            }).Take(takeCount).ToList();

            var contacts = contactService.GetContacts().Select(x => new ContactManageModel
            {
                Id       = x.Id,
                FullName = x.FullName,
                Email    = x.Email,
                Message  = x.Message,
                Subject  = x.Subject,
                IsRead   = x.IsRead,
                Date     = x.DateUtc
            }).Take(takeCount).ToList();

            var comments = postService.GetWaitingForApproveComments().Where(s => !string.IsNullOrEmpty(s.Commentary)).Select(x => new CommentListModel
            {
                Id         = x.Id,
                PostId     = x.PostId,
                ParentId   = x.ParentId,
                FullName   = x.FullName,
                Comment    = x.Commentary,
                CreateDate = x.CommentDateUtc.ToRelativeFormat(),
                Approved   = x.Approved,
                UserId     = x.UserId
            }).Take(takeCount).ToList();

            var applyJobs = applyJobService.GetApplyJobs().Select(x => new ApplyJobModel
            {
                Id        = x.Id,
                FullName  = x.FullName,
                Email     = x.Email,
                IsActive  = x.IsActive,
                ApplyDate = x.ApplyDateUtc,
                IsRead    = x.IsRead,
                Message   = x.Message,
                Phone     = x.Phone,
                Website   = x.Website,
                JobId     = x.JobId,
                JobName   = jobService.GetById(x.JobId).Title
            }).Take(takeCount).ToList();

            var model = new DashboardViewModel();

            model.Contacts    = contacts;
            model.Comments    = comments;
            model.ApplyJobs   = applyJobs;
            model.LatestUsers = users;

            return(View(model));
        }