Пример #1
0
        public ActionResult AddCreative(CreativeModel post)
        {
            User user = Helpers.AuthentificationHelper.GetUser(HttpContext);
            var creative = new Creative()
            {
                CreationDate = DateTime.Now,
                UserId = user.Id,
                ShortDescription = post.Description,
                Title = post.Title,
            };

            DataBase.AddCreative(creative, post.Tags);
            return RedirectToAction("Main", "Home");
        }
Пример #2
0
        public ActionResult EditCreative(int creativeId)
        {
            var creative = DataBase.GetCreative(creativeId);
            var list = creative.Chapter.ToList();

            list.Sort((x, y) => ((int)x.Number).CompareTo(y.Number));
            var model = new CreativeModel
                {
                    Title = creative.Title,
                    Chapters = list,
                    Description = creative.ShortDescription,
                    Tags = string.Concat(creative.Tag.Select(a => a.Name), ", "),
                    Creative = creative,

                };
            return View(model);
        }
Пример #3
0
        public ActionResult WatchCreative(int creativeId)
        {
            var creative = DataBase.GetCreative(creativeId);
            List<Chapter> list = creative.Chapter.ToList();

            list.Sort((x, y) => ((int)x.Number).CompareTo(y.Number));
            var markdown = new Markdown();

            var model = new CreativeModel
            {
                Title = creative.Title,
                Chapters = list,
                Description = creative.ShortDescription,
                Tags = string.Concat(creative.Tag.Select(a => a.Name), ", "),
                Creative = creative,
                WholeText = markdown.Transform(string.Concat(creative.Chapter.Select(x => "###\t" + x.Name + "\r" + x.Text + "\r"))),

            };
            return View(model);
        }