Exemple #1
0
        public async Task <IActionResult> AddM3U(string name, string url)
        {
            await defaultContext.AddAsync(new M3USource
            {
                Name = name,
                Url  = url
            });

            await defaultContext.SaveChangesAsync();

            return(Redirect("/"));
        }
Exemple #2
0
        private async Task MockDatabase(DefaultContext context)
        {
            bool containsSunData = await context.SunData.AnyAsync();

            if (!containsSunData)
            {
                SunData sunData = new SunData();
                sunData.Date    = DateTime.Today.AddDays(-1);
                sunData.Sunrise = sunData.Date.Add(new TimeSpan(7, 38, 0));
                sunData.Sunset  = sunData.Date.Add(new TimeSpan(17, 57, 0));
                await context.AddAsync(sunData);
            }

            await context.SaveChangesAsync();
        }