/// <summary> /// выбор лучших историй /// </summary> /// <returns></returns> public ActionResult GetBestStory() { story = new Story(conn); art =story.SelBestStory(10); ViewBag.Art = art; ViewBag.ArtCount = art.Count(); return View("Index"); }
/// <summary> /// случайная статья /// </summary> /// <returns></returns> public ActionResult GetStoryByRandomID() { Random rand = new Random(); int id = rand.Next(0, 60); story = new Story(conn); ViewBag.Art = story.SelStoryByID(id); ViewBag.ArtCount = 1; return View("Index"); }
public ActionResult Index() { story = new Story(conn); string getID = (string)RouteData.Values["id"]; if (getID != null) { int getIntID = (int.Parse(getID)-1) * 10; art = story.SelStoryLimitId(getIntID,10); } else art = story.SelStoryLimitId(0,10); ViewBag.Art = art; ViewBag.ArtCount = art.Count(); return View(); }
public ActionResult AddStory(Article art) { story = new Story(conn); if (ModelState.IsValid)//если модель валидна, всё заполнено верно { if (story.AddStory(art) == -1)//если не добавилось { ViewBag.errorsql = story.error; ViewBag.query = story.query; return View("AddStoryFalse", art); } ViewBag.errorsql = story.error; ViewBag.query = story.query; return View("AddStorySuccess", art); } return View(art); }