Exemplo n.º 1
0
        public List <string> GetBreadCrumbs(UserWorksVM model)
        {
            var breadcrumb = new List <string>();

            breadcrumb.Add(_helper.ActionLink <ClientController>(c =>
                                                                 c.PrivatePerson(SimplePages.Urls.Works, null),
                                                                 "Работы выпускников").ToString());
            if (model.WorkSection != null)
            {
                breadcrumb.Add(_helper.UserWorks(model.Section));
            }
            return(breadcrumb);
        }
Exemplo n.º 2
0
        public ActionResult UserWorks(int sectionID, int workSectionID, int?pageIndex)
        {
            if (!pageIndex.HasValue)
            {
                return(RedirectToAction(() => UserWorks(sectionID, workSectionID, 1)));
            }
            var index = pageIndex.Value - 1;

            var works = UserWorkService.GetAll().IsActive()
                        .Where(uw => uw.Section_ID == sectionID);
            var model = new UserWorksVM {
                Section = SectionService.GetByPK(sectionID),
            };

            if (workSectionID != 0)
            {
                model.WorkSection = UserWorkSectionService.GetByPK(workSectionID);
                works             = works.Where(uw => uw.WorkSectionID == workSectionID);
            }

            model.UserWorks = works.OrderByDescending(uw => uw.UserWorkID)
                              .ToPagedList(index, 10);
            return(View(model));
        }