public IActionResult SubmitQuestion(Question q, IEnumerable <string> tags)
        {
            var repository = new QuestionsRepository(_conn);

            repository.AddQuestion(q, tags);
            return(Redirect("/home/index"));
        }
Exemplo n.º 2
0
        public IActionResult AddQuestion(Question question, string tagString)
        {
            var repo = new QuestionsRepository(_connectionString);

            repo.AddQuestion(question, tagString);
            return(Redirect("/"));
        }
Exemplo n.º 3
0
        public IActionResult Add(Question question, IEnumerable <string> tags)
        {
            question.DatePosted = DateTime.Now;
            var repo = new QuestionsRepository(_connectionString);

            repo.AddQuestion(question, tags);
            return(Redirect("/questions"));
        }
Exemplo n.º 4
0
        public IActionResult Add(Question question, List <string> tags)
        {
            question.UserId     = GetCurrentUserId().Value;
            question.DatePosted = DateTime.Now;
            var repo = new QuestionsRepository(_connectionString);

            repo.AddQuestion(question, tags);
            return(Redirect("/home/index"));
        }
Exemplo n.º 5
0
        public IActionResult Add(Question q, List <string> tags)
        {
            var questionRepo = new QuestionsRepository(_connectionString);
            var usersRepo    = new UsersRepository(_connectionString);

            q.User       = usersRepo.GetUserByEmail(User.Identity.Name);
            q.DatePosted = DateTime.Now;
            questionRepo.AddQuestion(q, tags);
            return(Redirect("Home/Index"));
        }
Exemplo n.º 6
0
        public IActionResult Add(Question question, IEnumerable <string> tags)
        {
            var repo = new QuestionsRepository(_connectionString);

            question.DatePosted = DateTime.Now;
            var email = User.Identity.Name;

            question.UserId = repo.GetByEmail(email).Id;
            repo.AddQuestion(question, tags);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 7
0
        public IActionResult Add(Question question, IEnumerable <string> tags)
        {
            question.Date = DateTime.Now;
            var userRepo = new UserRepository(_connectionString);
            var user     = userRepo.GetByEmail(User.Identity.Name);

            question.UserId = user.Id;
            var questionsRepo = new QuestionsRepository(_connectionString);

            questionsRepo.AddQuestion(question, tags);
            return(RedirectToAction("ViewQuestion", new { id = question.Id }));
        }