Пример #1
0
        public ActionResult AddNewTopic(string topicMessage)
        {
            string emailFrom = ((FormsIdentity)System.Web.HttpContext.Current.User.Identity).Name.ToString();
            User signedUser = db.Users.Where(user => user.email.Trim() == emailFrom).Single();

            Project activeProject = Session["project"] as Project;

            Message newTopic = new Message();
            newTopic.idMessageAuthor = signedUser.idUser;
            newTopic.idProject = activeProject.idProject;
            newTopic.messageContent = topicMessage;
            newTopic.timeCreated = DateTime.Now;

            //Ubaci u bazu, da se pridjeli idMessage
            db.Messages.InsertOnSubmit(newTopic);
            db.SubmitChanges();

            //Zatim da id pridjeli idTopic jer se radni o novom topicu
            newTopic.idMessageTopic = newTopic.idMessage;
            db.SubmitChanges();

            return Redirect("Index");
        }
Пример #2
0
        public RedirectResult UpdateReply(string topicID, string messageText)
        {
            int id = Int32.Parse(topicID);
            string emailFrom = ((FormsIdentity)System.Web.HttpContext.Current.User.Identity).Name.ToString();
            User signedUser = db.Users.Where(user => user.email.Trim() == emailFrom).Single();

            Project activeProject = Session["project"] as Project;

            Message replyToTopic = new Message();
            replyToTopic.idMessageAuthor = signedUser.idUser;
            replyToTopic.idMessageTopic = id;
            replyToTopic.idProject = activeProject.idProject;
            replyToTopic.messageContent = messageText;
            replyToTopic.timeCreated = DateTime.Now;

            db.Messages.InsertOnSubmit(replyToTopic);
            db.SubmitChanges();

            return Redirect("OpenThread?topicID=" + topicID);
        }
Пример #3
0
 partial void DeleteMessage(Message instance);
Пример #4
0
 partial void UpdateMessage(Message instance);
Пример #5
0
 partial void InsertMessage(Message instance);
Пример #6
0
 /// <summary>
 /// Create a new Message object.
 /// </summary>
 /// <param name="idMessage">Initial value of the idMessage property.</param>
 /// <param name="messageHeader">Initial value of the messageHeader property.</param>
 /// <param name="messageContent">Initial value of the messageContent property.</param>
 /// <param name="dateCreated">Initial value of the dateCreated property.</param>
 /// <param name="idMessageAuthor">Initial value of the idMessageAuthor property.</param>
 /// <param name="idProject">Initial value of the idProject property.</param>
 public static Message CreateMessage(global::System.Int32 idMessage, global::System.String messageHeader, global::System.String messageContent, global::System.DateTime dateCreated, global::System.Int32 idMessageAuthor, global::System.Int32 idProject)
 {
     Message message = new Message();
     message.idMessage = idMessage;
     message.messageHeader = messageHeader;
     message.messageContent = messageContent;
     message.dateCreated = dateCreated;
     message.idMessageAuthor = idMessageAuthor;
     message.idProject = idProject;
     return message;
 }
Пример #7
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Message EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMessage(Message message)
 {
     base.AddObject("Message", message);
 }