public async Task WriteMessage(int dialogId, Message message) { var dialog = await db.Dialogs.FindAsync(dialogId); if (dialog != null) { db.Entry(dialog).Collection(r => r.Messages).Load(); dialog.Messages.Add(message); await db.SaveChangesAsync(); } }
public async Task Update(File file) { db.Entry(file).State = EntityState.Modified; await db.SaveChangesAsync(); }