public IActionResult AddPost(PostCreator postCreator) { postCreator.Owner = Request.Headers["Owner"].FirstOrDefault(); if (string.IsNullOrEmpty(postCreator.Owner)) { postCreator.Owner = "AnyƔd"; // postCreator.Owner = Request.Body["Owner"].FirstOrDefault(); } Post newPost = redditService.CreatePost(postCreator); return(Json(newPost)); }
public IActionResult Add(string content) { redditService.redditRepository.AddNewPost(redditService.CreatePost(content)); return(RedirectToAction("index")); }