Exemple #1
0
 public Handler([NotNull] DataContext context, [NotNull] IUserAccessor userAccessor, [NotNull] IPhotoAccessor photoAccessor)
 {
     _context       = context ?? throw new ArgumentNullException(nameof(context));
     _userAccessor  = userAccessor ?? throw new ArgumentNullException(nameof(userAccessor));
     _photoAccessor = photoAccessor ?? throw new ArgumentNullException(nameof(photoAccessor));
 }
Exemple #2
0
 public Handler(DataContext context, IPhotoAccessor photoAccessor)
 {
     _photoAccessor = photoAccessor;
     _context       = context;
 }
Exemple #3
0
 public Handler(DataContext context, IUserAccessor usserAccessor, IPhotoAccessor photoAccessor)
 {
     this._usserAccessor = usserAccessor;
     this._photoAccessor = photoAccessor;
     this._context       = context;
 }
Exemple #4
0
 public Handler(DataContext dataContext, IUserAccessor userAccessor, IPhotoAccessor photoAccessor)
 {
     _photoAccessor = photoAccessor;
     _userAccessor  = userAccessor;
     _dataContext   = dataContext;
 }
Exemple #5
0
 public Handler(ApplicationDbContext db, IUserAccessor userAccessor, IPhotoAccessor photoAccessor)
 {
     _photoAccessor = photoAccessor;
     _userAccessor  = userAccessor;
     _db            = db;
 }
 public Handler(ApplicationDbContext context, IPhotoAccessor photoAccessor)
 {
     _photoAccessor = photoAccessor;
     _context       = context;
 }
Exemple #7
0
 public Handler(AppDbContext context, IPhotoAccessor photoAccessor, IUserAccessor userAccessor)
 {
     _context       = context;
     _photoAccessor = photoAccessor;
     _userAccessor  = userAccessor;
 }
Exemple #8
0
        public static async Task SeedData(DataContext context,
                                          UserManager <AppUser> userManager, IPhotoAccessor photoAccessor)
        {
            if (!userManager.Users.Any())
            {
                var users = new List <AppUser>
                {
                    new AppUser
                    {
                        Id          = "a",
                        DisplayName = "Bob",
                        UserName    = "******",
                        Email       = "*****@*****.**",
                        Photos      = new List <Photo> {
                            photoAccessor.GetPhotoFromUrl("https://randomuser.me/api/portraits/men/69.jpg", true),
                            photoAccessor.GetPhotoFromUrl("https://picsum.photos/id/896/300/300.jpg", false),
                            photoAccessor.GetPhotoFromUrl("https://picsum.photos/id/603/300/300.jpg", false),
                            photoAccessor.GetPhotoFromUrl("https://picsum.photos/id/2/300/300.jpg", false),
                            photoAccessor.GetPhotoFromUrl("https://picsum.photos/id/183/300/300.jpg", false),
                        }
                    },
                    new AppUser
                    {
                        Id          = "b",
                        DisplayName = "Jane",
                        UserName    = "******",
                        Email       = "*****@*****.**",
                        Photos      = new List <Photo> {
                            photoAccessor.GetPhotoFromUrl("https://randomuser.me/api/portraits/women/42.jpg", true),
                            photoAccessor.GetPhotoFromUrl("https://picsum.photos/id/814/300/300.jpg", false),
                            photoAccessor.GetPhotoFromUrl("https://picsum.photos/id/811/300/300.jpg", false),
                            photoAccessor.GetPhotoFromUrl("https://picsum.photos/id/659/300/300.jpg", false),
                            photoAccessor.GetPhotoFromUrl("https://picsum.photos/id/615/300/300.jpg", false)
                        }
                    },
                    new AppUser
                    {
                        Id          = "c",
                        DisplayName = "Tom",
                        UserName    = "******",
                        Email       = "*****@*****.**",
                        Photos      = new List <Photo> {
                            photoAccessor.GetPhotoFromUrl("https://randomuser.me/api/portraits/men/36.jpg", true),
                            photoAccessor.GetPhotoFromUrl("https://picsum.photos/id/877/300/300.jpg", false),
                            photoAccessor.GetPhotoFromUrl("https://picsum.photos/id/87/300/300.jpg", false),
                            photoAccessor.GetPhotoFromUrl("https://picsum.photos/id/52/300/300.jpg", false),
                            photoAccessor.GetPhotoFromUrl("https://picsum.photos/id/848/300/300.jpg", false)
                        }
                    }
                };

                foreach (var user in users)
                {
                    await userManager.CreateAsync(user, "Pa$$w0rd");
                }
            }
            Console.WriteLine(DateTime.Now);
            if (!context.Activities.Any())
            {
                var activities = new List <Activity>
                {
                    new Activity
                    {
                        Title          = "Past Activity 1",
                        Date           = DateTime.Now.AddDays(-2),
                        Description    = "Activity 2 days ago",
                        Category       = "Drinks",
                        City           = "London Downtown",
                        Latitute       = 51.5073509,
                        Longitute      = -0.12775829999998223,
                        Venue          = "Pub",
                        UserActivities = new List <UserActivity>
                        {
                            new UserActivity
                            {
                                AppUserId  = "a",
                                IsHost     = true,
                                DateJoined = DateTime.Now.AddDays(-2)
                            }
                        }
                    },
                    new Activity
                    {
                        Title          = "Past Activity 2",
                        Date           = DateTime.Now.AddDays(-1),
                        Description    = "Activity 1 month ago",
                        Category       = "Culture",
                        City           = "Paris",
                        Latitute       = 48.856614,
                        Longitute      = 2.3522219000000177,
                        Venue          = "The Louvre",
                        UserActivities = new List <UserActivity>
                        {
                            new UserActivity
                            {
                                AppUserId  = "b",
                                IsHost     = true,
                                DateJoined = DateTime.Now.AddDays(-1)
                            },
                            new UserActivity
                            {
                                AppUserId  = "a",
                                IsHost     = false,
                                DateJoined = DateTime.Now.AddDays(-1)
                            },
                        }
                    },
                    new Activity
                    {
                        Title          = "Future Activity 1",
                        Date           = DateTime.Now.AddDays(1),
                        Description    = "Activity 1 month in future",
                        Category       = "Music",
                        City           = "Braunschweig",
                        Latitute       = 52.2688736,
                        Longitute      = 10.526769599999966,
                        Venue          = "Eintracht-Stadion",
                        UserActivities = new List <UserActivity>
                        {
                            new UserActivity
                            {
                                AppUserId  = "b",
                                IsHost     = true,
                                DateJoined = DateTime.Now.AddDays(1)
                            },
                            new UserActivity
                            {
                                AppUserId  = "a",
                                IsHost     = false,
                                DateJoined = DateTime.Now.AddDays(1)
                            },
                        }
                    },
                    new Activity
                    {
                        Title          = "Future Activity 2",
                        Date           = DateTime.Now.AddDays(2),
                        Description    = "Activity 2 days in future",
                        Category       = "Food",
                        City           = "Berlin",
                        Latitute       = 52.52000659999999,
                        Longitute      = 13.404953999999975,
                        Venue          = "Italian Food",
                        UserActivities = new List <UserActivity>
                        {
                            new UserActivity
                            {
                                AppUserId  = "c",
                                IsHost     = true,
                                DateJoined = DateTime.Now.AddDays(2)
                            },
                            new UserActivity
                            {
                                AppUserId  = "a",
                                IsHost     = false,
                                DateJoined = DateTime.Now.AddDays(2)
                            },
                        }
                    },
                    new Activity
                    {
                        Title          = "Future Activity 3",
                        Date           = DateTime.Now.AddDays(3),
                        Description    = "Activity 3 days in future",
                        Category       = "Drinks",
                        City           = "London",
                        Latitute       = 51.5073509,
                        Longitute      = -0.12775829999998223,
                        Venue          = "Pub",
                        UserActivities = new List <UserActivity>
                        {
                            new UserActivity
                            {
                                AppUserId  = "b",
                                IsHost     = true,
                                DateJoined = DateTime.Now.AddDays(3)
                            },
                            new UserActivity
                            {
                                AppUserId  = "c",
                                IsHost     = false,
                                DateJoined = DateTime.Now.AddDays(3)
                            },
                        }
                    },
                    new Activity
                    {
                        Title          = "Future Activity 4",
                        Date           = DateTime.Now.AddDays(4),
                        Description    = "Activity 4 days in future",
                        Category       = "Culture",
                        City           = "Paris",
                        Latitute       = 48.856614,
                        Longitute      = 2.3522219000000177,
                        Venue          = "Eiffel Tower",
                        UserActivities = new List <UserActivity>
                        {
                            new UserActivity
                            {
                                AppUserId  = "a",
                                IsHost     = true,
                                DateJoined = DateTime.Now.AddDays(4)
                            }
                        }
                    },
                    new Activity
                    {
                        Title          = "Future Activity 5",
                        Date           = DateTime.Now.AddDays(5),
                        Description    = "Activity 5 days in future",
                        Category       = "Drinks",
                        City           = "Brunswick",
                        Latitute       = 52.2688736,
                        Longitute      = 10.526769599999966,
                        Venue          = "Brunswick castle",
                        UserActivities = new List <UserActivity>
                        {
                            new UserActivity
                            {
                                AppUserId  = "c",
                                IsHost     = true,
                                DateJoined = DateTime.Now.AddDays(5)
                            },
                            new UserActivity
                            {
                                AppUserId  = "b",
                                IsHost     = false,
                                DateJoined = DateTime.Now.AddDays(5)
                            },
                        }
                    },
                    new Activity
                    {
                        Title          = "Future Activity 6",
                        Date           = DateTime.Now.AddDays(6),
                        Description    = "Activity 6 days in future",
                        Category       = "Music",
                        City           = "Berlin",
                        Latitute       = 52.52000659999999,
                        Longitute      = 13.404953999999975,
                        Venue          = "Brandenburg Gate",
                        UserActivities = new List <UserActivity>
                        {
                            new UserActivity
                            {
                                AppUserId  = "a",
                                IsHost     = true,
                                DateJoined = DateTime.Now.AddDays(6)
                            },
                            new UserActivity
                            {
                                AppUserId  = "b",
                                IsHost     = false,
                                DateJoined = DateTime.Now.AddDays(6)
                            },
                        }
                    },
                    new Activity
                    {
                        Title          = "Future Activity 7",
                        Date           = DateTime.Now.AddDays(7),
                        Description    = "Activity 7 days in future",
                        Category       = "Travel",
                        City           = "Berlin",
                        Latitute       = 52.52000659999999,
                        Longitute      = 13.404953999999975,
                        Venue          = "Berlin Television Tower",
                        UserActivities = new List <UserActivity>
                        {
                            new UserActivity
                            {
                                AppUserId  = "a",
                                IsHost     = true,
                                DateJoined = DateTime.Now.AddDays(7)
                            },
                            new UserActivity
                            {
                                AppUserId  = "c",
                                IsHost     = false,
                                DateJoined = DateTime.Now.AddDays(7)
                            },
                        }
                    },
                    new Activity
                    {
                        Title          = "Future Activity 8",
                        Date           = DateTime.Now.AddDays(8),
                        Description    = "Activity 8 days in future",
                        Category       = "Drinks",
                        City           = "Berlin",
                        Latitute       = 52.52000659999999,
                        Longitute      = 13.404953999999975,
                        Venue          = "Berlin Cathedral",
                        UserActivities = new List <UserActivity>
                        {
                            new UserActivity
                            {
                                AppUserId  = "b",
                                IsHost     = true,
                                DateJoined = DateTime.Now.AddDays(8)
                            },
                            new UserActivity
                            {
                                AppUserId  = "a",
                                IsHost     = false,
                                DateJoined = DateTime.Now.AddDays(8)
                            },
                        }
                    },
                    new Activity
                    {
                        Title          = "Future Activity 9",
                        Date           = DateTime.Now.AddDays(8),
                        Description    = "Activity 8 days in future",
                        Category       = "Drinks",
                        City           = "Berlin",
                        Latitute       = 52.52000659999999,
                        Longitute      = 13.404953999999975,
                        Venue          = "Kurfürstendamm",
                        UserActivities = new List <UserActivity>
                        {
                            new UserActivity
                            {
                                AppUserId  = "b",
                                IsHost     = true,
                                DateJoined = DateTime.Now.AddDays(8)
                            },
                            new UserActivity
                            {
                                AppUserId  = "c",
                                IsHost     = false,
                                DateJoined = DateTime.Now.AddDays(8)
                            },
                        }
                    }
                };

                await context.Activities.AddRangeAsync(activities);
            }
            if (!context.FollowerFollowings.Any())
            {
                var FollowerFollowings = new List <FollowerFollowings>()
                {
                    new FollowerFollowings {
                        UserAId = "a",
                        UserBId = "b"
                    },
                    new FollowerFollowings {
                        UserAId = "b",
                        UserBId = "a"
                    },
                    new FollowerFollowings {
                        UserAId = "a",
                        UserBId = "c"
                    },
                    new FollowerFollowings {
                        UserAId = "c",
                        UserBId = "a"
                    },
                    new FollowerFollowings {
                        UserAId = "c",
                        UserBId = "b"
                    }
                };
                await context.FollowerFollowings.AddRangeAsync(FollowerFollowings);
            }
            await context.SaveChangesAsync();
        }
Exemple #9
0
 public Handler(DataContext context, IPhotoAccessor photoAccessor, IUserAccess userAccess)
 {
     _context       = context;
     _photoAccessor = photoAccessor;
     _userAccess    = userAccess;
 }
 public UserController(IMediator mediator, IPhotoAccessor photoAccessor)
 {
     _mediator = mediator;
 }
Exemple #11
0
 public Handler(DataContext context, IMapper mapper, IUserAccessor userAccessor, IPhotoAccessor photoAccessor)
 {
     _context       = context;
     _mapper        = mapper;
     _userAccessor  = userAccessor;
     _photoAccessor = photoAccessor;
 }
Exemple #12
0
 public Handler(IPhotoAccessor photoAccessor, IUnitOfWork unitOfWork)
 {
     _photoAccessor = photoAccessor;
     _unitOfWork    = unitOfWork;
 }
Exemple #13
0
 public Handler(MyDbContext context, IPhotoAccessor photoAccessor)
 {
     this._photoAccessor = photoAccessor;
     this._context       = context;
 }
 public CommentPhotoUrlResolver(IPhotoAccessor photoAccessor)
 {
     _photoAccessor = photoAccessor;
 }
Exemple #15
0
 public Handler(DataContext context, UserManager <AppUser> userManager, IUserAccessor userAccessor, IPhotoAccessor photoAccessor)
 {
     this.context       = context;
     this.photoAccessor = photoAccessor;
     this.userAccessor  = userAccessor;
     this.userManager   = userManager;
 }
 public AddPhotoCommandHandler(ReactivitiesDbContext context, IUserAccessor userAccessor, IPhotoAccessor photoAccessor)
 {
     _context       = context;
     _userAccessor  = userAccessor;
     _photoAccessor = photoAccessor;
 }
 public AttendeePhotoUrlResolver(IPhotoAccessor photoAccessor)
 {
     _photoAccessor = photoAccessor;
 }
 public EFPhotoRepository(IPhotoAccessor photoAccessor, ApplicationDbContext context)
 {
     _photoAccessor = photoAccessor;
     _context       = context;
 }
Exemple #19
0
 public Handler(RecipesDbContext context, UserManager <AppUser> userManager, ICurrentUserAccessor currentUserAccessor, IPhotoAccessor photoAccessor)
 {
     this.context             = context;
     this.userManager         = userManager;
     this.currentUserAccessor = currentUserAccessor;
     this.photoAccessor       = photoAccessor;
 }
Exemple #20
0
 public ProjectEditHandler(DataContext context, IMapper mapper, IPhotoAccessor photoAccessor)
 {
     _context       = context;
     _mapper        = mapper;
     _photoAccessor = photoAccessor;
 }
 public Handler(DataContext db, IPhotoAccessor phAccessor, IUserAccessor uAccessor)
 {
     this._uAccessor  = uAccessor;
     this._phAccessor = phAccessor;
     this._db         = db;
 }
Exemple #22
0
 public Handler(IUnitOfWork unitOfWork, IMapperHelper mapperHelper, IPhotoAccessor photoAccessor)
 {
     _unitOfWork    = unitOfWork;
     _mapperHelper  = mapperHelper;
     _photoAccessor = photoAccessor;
 }
 public Handler(IPhotoAccessor photoAccesor, DataContext dataContext)
 {
     _dataContext  = dataContext;
     _photoAccesor = photoAccesor;
 }
Exemple #24
0
 public Handler(CoopUpContext context, IUserAccessor userAccessor, IPhotoAccessor photoAccessor)
 {
     _photoAccessor = photoAccessor;
     _userAccessor  = userAccessor;
     _context       = context;
 }
Exemple #25
0
 public Handler(Datacontext datacontext, IUserAccessor userAccessor, IPhotoAccessor photoAccessor)
 {
     this._photoAccessor = photoAccessor;
     this._userAccessor  = userAccessor;
     this._datacontext   = datacontext;
 }
Exemple #26
0
 public Handler(DataContext context, IMapper mapper, IPhotoAccessor photoAccessor)
 {
     _photoAccessor = photoAccessor;
     _mapper        = mapper;
     _context       = context;
 }
Exemple #27
0
 public Handler(DataContext context, IUserAccessor userAccesor, IPhotoAccessor photoAccessor)
 {
     _userAccesor   = userAccesor;
     _photoAccessor = photoAccessor;
     _context       = context;
 }
 public PhotoHandler(DataContext context, IUserAccessor userAccessor, IPhotoAccessor photoAccessor)
     : base(context, userAccessor)
 {
     _photoAccessor = photoAccessor;
 }
Exemple #29
0
 public Handler(DataContext context, IUserAccessor userAccessor, IPhotoAccessor photoAccessor)
 {
     this.context       = context;
     this.userAccessor  = userAccessor;
     this.photoAccessor = photoAccessor;
 }
Exemple #30
0
 public Handler(DataContext Context, IUserAccessor UserAccessor, IPhotoAccessor PhotoAccessor)
 {
     this.photoAccessor = PhotoAccessor; this.userAccessor = UserAccessor; this.context = Context;
 }