Esempio n. 1
0
 public ActionResult SearchTag(string search)
 {
     ViewBag.search   = NewsTagsService.FindSuitableNewsTag(search);
     ViewBag.tags     = TagService.GetTagsList();
     ViewBag.isSearch = true;
     return(View("StartPage"));
 }
Esempio n. 2
0
        public void RemoveTagNews(string param)
        {
            List <string> tagList = HomeController.newsIdTagsPairs[AccountController.changeNewId];

            tagList.Remove(param);
            HomeController.newsIdTagsPairs[AccountController.changeNewId] = tagList;
            NewsTagsService.Remove(AccountController.changeNewId, param);
        }
Esempio n. 3
0
        public void InsertNewPair(string param)
        {
            List <string> tagList = HomeController.newsIdTagsPairs[AccountController.changeNewId];

            tagList.Add(param);
            HomeController.newsIdTagsPairs[AccountController.changeNewId] = tagList;
            TagService.InsertTag(param);
            NewsTagsService.InserNewPair(AccountController.changeNewId, TagService.GetIdTag(param));
        }
Esempio n. 4
0
        public RedirectToRouteResult NewNews(New news)
        {
            if (news.title == null || news.category == null || news.text == null || news.description == null)
            {
                newValid = false;
                return(RedirectToAction("Index", "Account"));
            }
            else
            {
                int idUser = 0;
                if (JsonController.changeUser > 0)
                {
                    idUser = UserService.user.userId;
                    UserService.ChangeUser(JsonController.changeUser);
                }
                newValid = true;
                if (NewService.InsertNew(UserService.user, news))
                {
                    TagService.InsertTags(JsonController.tagList);
                    NewsTagsService.InserNewPairs(JsonController.tagList, news.title);
                    myNews.Push(NewService.newStack.FirstOrDefault());
                    newExist = false;
                    if (idUser > 0)
                    {
                        UserService.ChangeUser(idUser);
                        idUser = 0;
                    }

                    return(RedirectToAction("StartPage", "Home"));
                }
                else
                {
                    newExist = true;
                }
            }
            return(RedirectToAction("Index", "Account"));
        }