public async Task <IActionResult> Create(Topic topic)
        {
            if (topicRepository.IsTopicRegistered(topic.TopicName) == false)
            {
                if (ModelState.IsValid)
                {
                    await _context.SaveChangesAsync();

                    topicRepository.AddTopic(topic);
                }
                return(RedirectToAction("Topic", "Topics"));
            }
            else
            {
                return(Content("This topic name is used.Registration is not possible."));
            }
        }
        public async Task <IActionResult> Create(User user)
        {
            if (userRep.IsUserRegistered(user.Mail) == false)
            {
                if (ModelState.IsValid)
                {
                    await _context.SaveChangesAsync();

                    userRep.AddUser(user);
                    SendActivationMail(user.UserID);
                    return(RedirectToAction("Activation"));
                }
                return(View(user));
            }
            else
            {
                ViewBag.Message = "This mail is used. Please try another mail.";
                return(View(user));
            }
        }
        public async Task <IActionResult> Create(Article article, int[] checkedId)
        {
            if (checkedId.Length > 0)
            {
                string content = HttpContext.Request.Form["Content"];
                if (articleRep.IsArticleRegister(article.Tittle) == true)
                {
                    return(Content("This title has been used before. You cannot use this title."));
                }

                else if (ModelState.IsValid)
                {
                    article.UserID  = userRep.GetUserByMail(Request.Cookies["EMail"]).UserID;
                    article.Content = HtmlToPlainText(content);
                    articleRep.AddArticle(article);

                    await _context.SaveChangesAsync();

                    ArticleTopic articleTopic = new ArticleTopic();

                    foreach (var topicID in checkedId)
                    {
                        articleTopic.ArticleID = article.ArticleID;
                        articleTopic.TopicID   = topicID;
                        articleRep.AddArticleTopic(articleTopic);
                    }

                    return(RedirectToAction(nameof(Index)));
                }
            }
            else
            {
                ViewBag.Message = "Please choose a topic name.";
            }
            return(View(article));
        }