Ejemplo n.º 1
0
 public SeedService(NewsManDbContext context, ISurveyMaster surveyMaster,
                    ISessionUser sessionUser, IAnswerGroup answerGroup,
                    IAnswerOption answerOption, IQuestion question,
                    ISurveyQuestion surveyQuestion, IResult result)
 {
     _context        = context;
     _surveyMaster   = surveyMaster;
     _sessionUser    = sessionUser;
     _answerGroup    = answerGroup;
     _answerOption   = answerOption;
     _question       = question;
     _surveyQuestion = surveyQuestion;
     _result         = result;
 }
Ejemplo n.º 2
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            const int NUM_OF_QUESTIONS = 8;

            using (var context = new NewsManDbContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <NewsManDbContext> >()))
            {
                // Look for any data first.
                if (context.Survey.Any())
                {
                    return;   // DB has been seeded
                }

                for (var x = 1; x < NUM_OF_QUESTIONS; x++)
                {
                    // loop y number of times for EACH question (x)
                    var q = new QMaster
                    {
                        Id = x
                    };

                    for (var y = 1; y < 100; y++)
                    {
                        int rnd = new Random().Next(1, 5);

                        context.Survey.AddRange(
                            new Survey
                        {
                            QMaster = q,
                            Answer  = rnd
                        }

                            );
                        context.SaveChanges();
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public SurveyService(NewsManDbContext context)
 {
     _context = context;
 }
Ejemplo n.º 4
0
 public SurveysController(NewsManDbContext context, ISurvey survey, IResult result)
 {
     _context = context;
     _survey  = survey;
     _result  = result;
 }
Ejemplo n.º 5
0
 public SurveyQuestionService(NewsManDbContext context)
 {
     _context = context;
 }
Ejemplo n.º 6
0
 public QMastersController(NewsManDbContext context)
 {
     _context = context;
 }
Ejemplo n.º 7
0
 public AnswerOptionService(NewsManDbContext context)
 {
     _context = context;
 }
Ejemplo n.º 8
0
 public ResultService(NewsManDbContext context)
 {
     _context = context;
 }
Ejemplo n.º 9
0
 public SessionUserService(NewsManDbContext context)
 {
     _context = context;
 }
Ejemplo n.º 10
0
 public AMasterService(NewsManDbContext context)
 {
     _context = context;
 }
Ejemplo n.º 11
0
 public FeedService(NewsManDbContext context)
 {
     _context = context;
 }
Ejemplo n.º 12
0
 public AnswerGroupService(NewsManDbContext context)
 {
     _context = context;
 }