Beispiel #1
0
        public IActionResult Create(IFormCollection formCollection)
        {
            Post post = new Post();

            post.UserId   = Convert.ToInt16(User.FindFirst("UserId").Value);
            post.DateTime = DateTime.Now;
            post.Title    = formCollection["Title"];
            post.Body     = formCollection["Body"];

            _postLogic.AddPost(post);
            return(RedirectToAction("AllPosts"));
        }
Beispiel #2
0
        public IActionResult CreatePost(PostViewModel model)
        {
            IPost post = new Post
            {
                Afbeelding = model.Afbeelding,
                Titel      = model.Titel,
                Vraag      = model.Vraag
            };

            postLogic.AddPost(post, HttpContext.Session.GetInt32("ID").GetValueOrDefault());
            return(RedirectToAction("Index"));
        }