Esempio n. 1
0
        public ActionResult ReplyToConversation(UserReplyToConversationViewModel model)
        {
            if (ModelState.IsValid)
            {
                User sender = _userTasks.GetUser(_principal.Identity.Name);
                Conversation conversation = sender.Conversations.SingleOrDefault(x => x.Id == model.Id);
                List<User> users = conversation.Users.ToList();

                users.Remove(sender);
                User reveiver = users.Single();

                string subject = _principal.Identity.Name + " has Replied to You";

                string body = _viewRenderer.RenderView(this, "~/Views/Email/ReplyToConversation.cshtml"
                                                       , new ReplyToViewModel
                                                       {
                                                       	ToUsername = reveiver.Username,
                                                       	FromUsername = _principal.Identity.Name
                                                       });

                Message message = _userTasks
                    .ReplyToConversation(conversation
                                         , sender
                                         , reveiver
                                         , model.Text
                                         , subject
                                         , body);

                return PartialView("Message", new MessageViewModel(message));
            }

            //TODO - throw ex or display to user the validation error
            return new EmptyResult();
        }
Esempio n. 2
0
 public ActionResult ReplyToConversation(int id)
 {
     var model = new UserReplyToConversationViewModel {Id = id};
     return PartialView(model);
 }