/// <summary>
 ///     This method gets called by the runtime and configures the Database context.
 /// </summary>
 public SCxViewController(SCxItemContext context)
 {
     _context = context;
     if (!_context.SCxItems.Any())
     {                                       // If no data - setup test data for the last 31 days.
         foreach (SCxItem sCxItem in SCxItem.AddThisMonthsSCxData(0))
         {
             _context.SCxItems.Add(sCxItem);
         }
         _context.SaveChangesAsync();
     }
 }
Exemple #2
0
 /// <summary>Set Razor Pages Databas Context</summary>
 public IndexModel(DbWebAPI.Models.SCxItemContext context)
 {
     _context = context;
     if (!_context.SCxItems.Any())
     {                                           // If no data - setup test data for the last 31 days.
         foreach (SCxItem sCxItem in SCxItem.AddThisMonthsSCxData())
         {
             _context.SCxItems.Add(sCxItem);
         }
         _context.SaveChangesAsync();
     }
 }
Exemple #3
0
 /// <summary>
 ///     This method gets called by the runtime and configures the Database context.
 /// </summary>
 public SCxItemsController(SCxItemContext context)
 {
     _context = context;
     if (!_context.SCxItems.Any())
     {                                               // If no data - setup test data for the past 3 years.
         for (var month = 0; month <= 36; month++)
         {
             foreach (SCxItem sCxItem in SCxItem.AddThisMonthsSCxData(month))
             {
                 _context.SCxItems.Add(sCxItem);
             }
             _context.SaveChangesAsync();
         }
     }
 }