Ejemplo n.º 1
0
 /// <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();
     }
 }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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();
         }
     }
 }