public ActionResult SendMail() { var hlpView = new HelpersViewModel(); var ddf = new EmailInfo(); ddf.ToRoles = hlpView.AllGroups.ToList(); ddf.ToReceivers = hlpView.UsersNameAll(); ddf.FromEmail = hlpView.GetUserEmail(WebSecurity.CurrentUserId); ddf.FromName = WebSecurity.CurrentUserName; return(View(ddf)); }
public ActionResult Create(Forum forum, string newTitle, string newMsg, int topicId) { if (ModelState.IsValid) { Forum f = new Forum(); f.TopicId = topicId; f.Msg = newMsg.Replace("\n", "<br/>"); f.Title = newTitle; if (forum.ForumId > 0) { f.ParentId = forum.ForumId; var fr = db.Forum.Single(i => i.ForumId == forum.ForumId); if (fr.UserId != WebSecurity.GetUserId(User.Identity.Name)) { SendMail(WebSecurity.CurrentUserName, HlpView.GetUserEmail(fr.UserId), topicId.ToString(), HlpView.GetForumTopicName(topicId), fr.Title, newTitle); } } f.PostDate = System.DateTime.Now; f.UserId = WebSecurity.GetUserId(User.Identity.Name); f.UserName = User.Identity.Name; //Request von Jaromir Ott //if (f.ParentId == null && f.TopicId == 4 && WebSecurity.GetUserId(User.Identity.Name) != 209) //{ // TempData["PostMsg"] = "Dein Eintrag wurde nicht geposted, Du kannst bei diesem Thema nur Antworten!"; // return RedirectToAction("ViewTopic", new { topicId = forum.TopicId, topicName = HlpView.GetForumTopicName(topicId) }); //} //End Request von Jaromir Ott db.Forum.AddObject(f); db.SaveChanges(); TempData["PostMsg"] = "Dein Eintrag wurde geposted"; return(RedirectToAction("ViewTopic", new { topicId = forum.TopicId, topicName = HlpView.GetForumTopicName(topicId) })); } return(View(forum)); }