Example #1
0
 public AssignmentsViewController(TaskAdministratorAPIContext context)
 {
     _context = context;
 }
 public UsersViewController(TaskAdministratorAPIContext context)
 {
     _context = context;
 }
Example #3
0
 public TasksController(TaskAdministratorAPIContext context)
 {
     _context = context;
 }
Example #4
0
        public static void InitializeSeed(IServiceProvider serviceProvider)
        {
            using (var context = new TaskAdministratorAPIContext(serviceProvider.GetRequiredService <DbContextOptions <TaskAdministratorAPIContext> >()))
            {
                if (context.Tasks.Any() || context.Users.Any())
                {
                    return;
                }

                context.Tasks.AddRange(

                    new Tasks
                {
                    Title            = "Mow The Lawn",
                    BeginDateTime    = DateTime.Now,
                    DeadlineDateTime = DateTime.Parse("01/01/2019 12:00:00 AM", System.Globalization.CultureInfo.InvariantCulture),
                    Requirements     = "This task is carried out by mowing the lawn."
                },

                    new Tasks
                {
                    Title            = "Walk The Dog",
                    BeginDateTime    = DateTime.Now,
                    DeadlineDateTime = DateTime.Parse("01/01/2019 12:00:00 AM", System.Globalization.CultureInfo.InvariantCulture),
                    Requirements     = "This task is carried out by walking the dog."
                },

                    new Tasks
                {
                    Title            = "Feed The Fish",
                    BeginDateTime    = DateTime.Now,
                    DeadlineDateTime = DateTime.Parse("01/01/2019 12:00:00 AM", System.Globalization.CultureInfo.InvariantCulture),
                    Requirements     = "This task is carried out by feeding the fish."
                }

                    );

                context.Users.AddRange(

                    new Users
                {
                    FirstName = "Iñaki",
                    LastName  = "Ordóñez"
                },

                    new Users
                {
                    FirstName = "Rafael",
                    LastName  = "Bauzá"
                },

                    new Users
                {
                    FirstName = "Cesc",
                    LastName  = "Fábregas"
                }

                    );
                context.SaveChanges();
            }
        }