Ejemplo n.º 1
0
        public IActionResult ForSession(int sessionId)
        {
            var session = _sessionRepository.GetById(sessionId);

            if (session == null)
            {
                return(HttpNotFound(sessionId));
            }
            var result = session.Ideas.Select(i => new IdeaDTO()
            {
                id          = i.Id,
                name        = i.Name,
                description = i.Description,
                dateCreated = i.DateCreated
            }).ToList();

            return(Ok(result));
        }
        public IActionResult Index(int?id)
        {
            if (!id.HasValue)
            {
                return(RedirectToAction("Index", "Home"));
            }
            var session = _sessionRepository.GetById(id.Value);

            if (session == null)
            {
                return(Content("Session not found."));
            }
            var viewModel = new StormSessionViewModel()
            {
                DateCreated = session.DateCreated,
                Name        = session.Name,
                Id          = session.Id
            };

            return(View(viewModel));
        }