public static async Task UpdateChannelMessage(this AppDbContext db, ChannelMessage message) { if (message.Validate()) { db.ChannelMessages.Update(message); await db.SaveChangesAsync(); } }
public static async Task AddChannelMessage(this AppDbContext db, ChannelMessage message) { if (message.Validate()) { message.MessageDate = DateTime.Now; await db.ChannelMessages.AddAsync(message); await db.SaveChangesAsync(); } }