private async Task UpdateGroupLastActivityDate(int?groupId, Message message) { var group = await _context.Groups.FirstAsync(g => g.Id == groupId); group.LastActivityDate = message.Date; _context.Attach(group); _context.Entry(group).Property("LastActivityDate").IsModified = true; }
public async Task <ActionResult> Edit([Bind(Include = "ChatMessageID,DateTime,SequenceNumber")] ChatMessage chatMessage) { if (ModelState.IsValid) { db.Entry(chatMessage).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(chatMessage)); }
public JsonResult MessageDelivered(int message_id) { Conversation convo = null; convo = _context.Conversations.FirstOrDefault(c => c.id == message_id); if (convo != null) { convo.status = Conversation.messageStatus.Delivered; _context.Entry(convo).State = EntityState.Modified; _context.SaveChanges(); } return(Json(convo)); }