예제 #1
0
        public static WelcomeMessage GetMessage(int id)
        {
            using var DbContext = new NamikoDbContext();
            WelcomeMessage message = DbContext.WelcomeMessages.Where(x => x.Id == id).FirstOrDefault();

            return(message);
        }
예제 #2
0
        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();
        }