public ActionResult CreatePost(InputPostViewModel model) { if (!ModelState.IsValid) { var categories = m_Categories.GetAllCategories().To <CategoriesViewModel>().ToList(); model.Categories = categories; return(View(model)); } var tags = m_Tags.CheckExist(model.Tags).ToList(); var userId = User.Identity.GetUserId(); var post = new Post { CategoryId = model.CategoryId, Content = model.Content, Tags = tags, Title = model.Title, UserId = userId }; m_Posts.CreatePost(post); TempData["Notification"] = "You successfully add your post."; return(RedirectToAction("Index")); }
public ActionResult Create(InputPostViewModel post) { var entity = this.Mapper.Map<InputPostViewModel, Post>(post); entity.DentistId = this.User.Identity.GetUserId(); this.posts.AddNewPost(entity); return this.RedirectToAction("Index", "Home", new { area = string.Empty }); }
public ActionResult InputPost(InputPostViewModel post) { var facebookClient = new FacebookClient(); var facebookService = new FacebookService(facebookClient); var account = facebookService.PostOnWall(post.AccessToken, post.Message); return(View(post)); }
public ActionResult Create(InputPostViewModel post) { var entity = this.Mapper.Map <InputPostViewModel, Post>(post); entity.DentistId = this.User.Identity.GetUserId(); this.posts.AddNewPost(entity); return(this.RedirectToAction("Index", "Home", new { area = string.Empty })); }
public ActionResult CreatePost() { var categories = m_Categories.GetAllCategories().To <CategoriesViewModel>().ToList(); var inputModel = new InputPostViewModel { Categories = categories }; return(View(inputModel)); }
public ActionResult CreatePost(InputPostViewModel model) { if (!this.ModelState.IsValid) { var categories = this.categories.GetAllCategories().To<CategoriesViewModel>().ToList(); model.Categories = categories; return this.View(model); } var tags = this.tags.CheckExist(model.Tags).ToList(); var userId = this.User.Identity.GetUserId(); var post = new Post { CategoryId = model.CategoryId, Content = model.Content, Tags = tags, Title = model.Title, UserId = userId }; this.posts.CreatePost(post); this.TempData["Notification"] = "You successfully add your post."; return this.RedirectToAction("Index"); }
public ActionResult CreatePost() { var categories = this.categories.GetAllCategories().To<CategoriesViewModel>().ToList(); var inputModel = new InputPostViewModel { Categories = categories }; return this.View(inputModel); }