public static WelcomeMessage GetMessage(int id) { using var DbContext = new NamikoDbContext(); WelcomeMessage message = DbContext.WelcomeMessages.Where(x => x.Id == id).FirstOrDefault(); return(message); }
public static async Task DeleteMessage(int id) { using var DbContext = new NamikoDbContext(); WelcomeMessage message = DbContext.WelcomeMessages.Where(x => x.Id == id).FirstOrDefault(); DbContext.WelcomeMessages.Remove(message); await DbContext.SaveChangesAsync(); }