public PartialViewResult AjaxAnswer(int id, AnswerMessageForm collection) { MessageService repoMessage = new MessageService(); CD.Message answer = repoMessage.Answer(new CD.Message() { Title = collection.Title, Text = collection.Message, EmployeeId = UserSession.CurrentUser.Id }, collection.MessageId); Subject subject = new Subject(repoMessage.GetConversation(id).Select(m => new MessageListItem(new M.Message(m)))); return(PartialView("_Subject", subject)); }
public PartialViewResult AjaxAnswer(int id, AnswerMessageForm collection) { MessageService repoMessage = new MessageService(); EmployeeService repoEmp = new EmployeeService(); CD.Message answer = repoMessage.Answer(new CD.Message() { Title = collection.Title, Text = collection.Message, EmployeeId = UserSession.CurrentUser.Id }, collection.MessageId); IEnumerable <MessageListItem> messages = repoMessage.GetConversation(id).Select(m => new MessageListItem(new M.Message(m))); IEnumerable <M.CurrentOn> participants = repoEmp.GetByMessageId(id).Select(e => new M.CurrentOn(e)); Messaging messaging = new Messaging(messages, participants); return(PartialView("_Messaging", messaging)); }
public ActionResult Answer(int id, AnswerMessageForm collection) { try { if (ModelState.IsValid) { MessageService repoMessage = new MessageService(); CD.Message m = repoMessage.Answer(new CD.Message() { Title = collection.Title, Text = collection.Message, EmployeeId = UserSession.CurrentUser.Id }, id); return(RedirectToAction("Details", new { id = m.Id })); } return(View(collection)); } catch { return(View(collection)); } }