public ActionResult SearchTag(string search) { ViewBag.search = NewsTagsService.FindSuitableNewsTag(search); ViewBag.tags = TagService.GetTagsList(); ViewBag.isSearch = true; return(View("StartPage")); }
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); }
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)); }
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")); }