示例#1
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var session = await _sessionRepository.GetByIdAsync(id);

            if (session != null)
            {
                await _sessionRepository.DeleteAsync(session);
            }

            return(RedirectToAction(actionName: nameof(Index),
                                    controllerName: "Brainstorm"));
        }
示例#2
0
        public async Task <IActionResult> Index(int?id)
        {
            Logger.Debug($"{nameof(Index)} started processing request");

            if (!id.HasValue)
            {
                Logger.Debug("Id is not passed, redirecting to the Home/Index");
                return(RedirectToAction(actionName: nameof(Index),
                                        controllerName: "Home"));
            }

            var session = await _sessionRepository.GetByIdAsync(id.Value);

            if (session == null)
            {
                Logger.Debug($"Session with id {id} wasn't found");
                return(Content("Session not found."));
            }

            var viewModel = new StormSessionViewModel()
            {
                DateCreated = session.DateCreated,
                Name        = session.Name,
                Id          = session.Id
            };

            Logger.Debug($"{nameof(Index)} finished processing request");

            return(View(viewModel));
        }
示例#3
0
        public async Task <IActionResult> Index(int?id)
        {
            if (!id.HasValue)
            {
                return(RedirectToAction(actionName: nameof(Index),
                                        controllerName: "Home"));
            }
            var session = await _sessionRepository.GetByIdAsync(id.Value);

            if (session == null)
            {
                return(Content("Session not found."));
            }

            var viewModel = new StormSessionViewModel()
            {
                DateCreated = session.DateCreated,
                Name        = session.Name,
                Id          = session.Id
            };

            _log4net.Debug("Debug message");
            _log4net.Debug("Debug message2");
            return(View(viewModel));
        }
示例#4
0
        public async Task <IActionResult> ForSession(int sessionId)
        {
            var session = await _sessionRepository.GetByIdAsync(sessionId);

            if (session == null)
            {
                return(NotFound(sessionId));
            }

            var result = session.Ideas.Select(idea => new IdeaDTO()
            {
                Id          = idea.Id,
                Name        = idea.Name,
                Description = idea.Description,
                DateCreated = idea.DateCreated
            }).ToList();

            return(Ok(result));
        }
示例#5
0
        public async Task <IActionResult> Index(int?id)
        {
            if (Logger.inited == false)
            {
                Logger.InitLogger();
            }

            if (!id.HasValue)
            {
                if (Logger.useLogs)
                {
                    Logger.Log.Info("Homepage");
                }
                return(RedirectToAction(actionName: nameof(Index),
                                        controllerName: "Home"));
            }

            var session = await _sessionRepository.GetByIdAsync(id.Value);

            if (session == null)
            {
                if (Logger.useLogs)
                {
                    Logger.Log.Error("Session not found");
                }

                return(Content("Session not found."));
            }

            var viewModel = new StormSessionViewModel()
            {
                DateCreated = session.DateCreated,
                Name        = session.Name,
                Id          = session.Id
            };

            if (Logger.useLogs)
            {
                Logger.Log.Debug($"session.DateCreated: {session.DateCreated} session.Name: {session.Name} session.Id: {session.Id}");
            }

            return(View(viewModel));
        }
        public async Task <IActionResult> Index(int?id)
        {
            if (!id.HasValue)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var session = await _sessionRepository.GetByIdAsync(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));
        }