Esempio n. 1
0
 public ActionResult AddMessage(int id, string name, string message)
 {
     var chat = _repository.FindByID(id);
     string returnMessage;
     if (message.Trim() != string.Empty)
     {
         var mess = new Message
         {
             ChatId = id,
             Name = name,
             Content = message,
             SentOn = DateTime.Now,
             Ip = "NotLogged"
         };
         _repository.UpdateParticipant(chat.Id, Session.SessionID, name);
         _repository.AddMessage(mess);
         returnMessage = "Message Received";
     }
     else
     {
         returnMessage = "Ignoring Empty Message";
     }
     if (Request.IsAjaxRequest())
     {
         return new ContentResult { Content = returnMessage };
     }
     TempData["message"] = returnMessage;
     return Redirect("/" + chat.Url);
 }
Esempio n. 2
0
 public void AddMessage(Message toAdd)
 {
     using (var session = _store.OpenSession())
     {
         session.Store(toAdd);
         session.SaveChanges();
     }
 }