Ejemplo n.º 1
0
        public IActionResult CampusDetail(string campusSlug)
        {
            if (campusSlug == null)
            {
                return(RedirectToAction("Error"));
            }

            var findCampus = _campusService.GetWeb(campusSlug);

            if (findCampus == null)
            {
                return(RedirectToAction("Error"));
            }

            CampusDetailViewModel viewModel = new CampusDetailViewModel
            {
                Name          = findCampus.Name,
                Address       = findCampus.Address,
                Description   = findCampus.Description,
                EditorContent = findCampus.EditorContent,
                EmailAddress  = findCampus.EmailAddress,
                Fax           = findCampus.Fax,
                ImageUrl      = findCampus.ImageUrl,
                Telephone     = findCampus.Telephone,
                Events        = findCampus.Events.ToList(),
                News          = findCampus.News.OrderByDescending(n => n.CreationDate).Take(5).ToList(),
                Staff         = findCampus.Staff.ToList()
            };

            return(View(viewModel));
        }