Ejemplo n.º 1
0
 public ActionResult SendMessage(MessageView messageView)
 {
     if (ModelState.IsValid)
     {
         var message = (Message)ModelMapper.Map(messageView, typeof(MessageView), typeof(Message));
         Repository.CreateMessage(message);
         return RedirectToAction("Index");
     }
     return View("NewMessage", messageView);
 }
Ejemplo n.º 2
0
 public ActionResult NewMessage(int recId = -1, int prevMessageId = -1)
 {
     var message = new MessageView();
     message.ReceiverId = recId;
     message.ReceiverNick = Repository.GetUser(recId).Nickname;
     message.SenderId = CurrentUser.UserId;
     message.SenderNick = CurrentUser.Nickname;
     message.PrevMessage = ((prevMessageId > 0) ? Repository.ReadMessage(prevMessageId) : null);
     message.Topic = ((message.PrevMessage != null) ? "Re: " + message.PrevMessage.Topic : null);
     return View(message);
 }