public int SetMessageDelivered(IEnumerable<tempMsg> msgs)
 {
     //find a optimized way to update the list of MId
        MessageTb objMsgTb;
        for (int i = 0; i < msgs.Count(); i++)
        {
        objMsgTb = new MessageTb();
        objMsgTb = model.MessageTbs.Single(e => e.MID == msgs.ToList()[i].MID);
        objMsgTb.Delivered = true;
        model.SaveChanges();
        }
        return 1;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the MessageTbs EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMessageTbs(MessageTb messageTb)
 {
     base.AddObject("MessageTbs", messageTb);
 }
 public int AddMsg(MessageTb msg)
 {
     msg.Delivered = false;
        model.MessageTbs.AddObject(msg);
        return model.SaveChanges();
 }
 /// <summary>
 /// Create a new MessageTb object.
 /// </summary>
 /// <param name="mID">Initial value of the MID property.</param>
 /// <param name="dateTime">Initial value of the DateTime property.</param>
 /// <param name="message">Initial value of the Message property.</param>
 /// <param name="delivered">Initial value of the Delivered property.</param>
 public static MessageTb CreateMessageTb(global::System.Int32 mID, global::System.DateTime dateTime, global::System.String message, global::System.Boolean delivered)
 {
     MessageTb messageTb = new MessageTb();
     messageTb.MID = mID;
     messageTb.DateTime = dateTime;
     messageTb.Message = message;
     messageTb.Delivered = delivered;
     return messageTb;
 }