public ActionResult Create(CreateLogEntry logentry) { LogEntry newEntry = new LogEntry(); newEntry.ParentProject = logentry.parentProject; newEntry.Content = logentry.content; newEntry.PostedOn = DateTime.Now; Debug.Write(logentry.posterName); string text =logentry.posterName.Replace("WARE", "WARE\\"); newEntry.PostedBy = db.Users.Where(b => b.Username == text).First(); if (ModelState.IsValid) { db.LogEntries.Add(newEntry); db.SaveChanges(); return new EmptyResult(); } return new EmptyResult(); }
public void Send(string LogMessage, int parentProject, string posterName) { LogEntry newEntry = new LogEntry(); newEntry.Content = LogMessage; newEntry.ParentProject = parentProject; string text = posterName.Replace("WARE", "WARE\\"); newEntry.PostedBy = db.Users.Where(b => b.Username == text).First(); newEntry.PostedOn = DateTime.Now; db.LogEntries.Add(newEntry); db.SaveChanges(); var md = new MarkdownDeep.Markdown(); md.ExtraMode = true; md.SafeMode = false; string MarkdownOutput = md.Transform(LogMessage); string output = "<div style='display: none;' class='custom-panels panel panel-default'><div class='panel-body' style='margin-bottom: 12px;'>" + MarkdownOutput + "<br /><i class='pull-right' style='font-size: smaller;'>Posted by " + newEntry.PostedBy.FirstName + " " + newEntry.PostedBy.LastName + " on " + newEntry.PostedOn.ToShortDateString() + "</i></div></div>"; Clients.All.send(output, parentProject); }