私は友人の間で会話を開くことができるアプリケーションを作った。誰かが私にメッセージを送ったときに「ジョンはあなたに新しいメッセージを送る」という通知を受け取り、会話中の他の人が私にメッセージを送ると、私の問題は、私は新しい通知をしたくないのですが、古い通知を元のものに更新したいのです。このように..「ジョンとアルフレッドはあなたに新しいメッセージを送る」通知を更新するには?
ここ var user = users.Where(x => x != CurrentUserId);
foreach (var item in user)
{
var check = entities.Notifications.SingleOrDefault(i => (i.NotificationForId == id
&& i.NotificationForType == IdType && i.UserId == item));
if (check == null)
{
Notification notify = new Notification()
{
NotificationForId = id,
NotificationForType = IdType,
DateTime = DateTime.Now,
Message = GenerateMessage(),
UserId = item,
SenderID = CurrentUserId.ToString(),
SenderName = CurrentUserName
};
entities.Notifications.AddObject(notify);
}
else
{
check.Checked = false;
check.DateTime = DateTime.Now;
}
ユーザーのための任意の通知がある場合はnullが、その後、「通知の更新」
何が問題なのですか? – BrunoLM