0
我做了一个应用程序,允许我打开朋友之间的对话,当有人给我发送消息时,我收到了一条通知“John给你发送了一条新消息”,当对话中的另一个人给我发送了一条消息时, ,,我的问题是,我不想做出新的通知,但我想更新旧的通知为前。像这样的“约翰和Alfred发送新信息” ..如何更新我的通知?
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