示例#1
0
 public GalleriesController(
     HipstagramContext context,
     IMapper mapper,
     IUserService userService,
     IGalleryService galleryService,
     IPhotoService photoService)
 {
     this._mapper         = mapper;
     this._userService    = userService;
     this._context        = context;
     this._galleryService = galleryService;
     this._photoService   = photoService;
 }
示例#2
0
 public PhotosController(
     HipstagramContext context,
     IHostingEnvironment environment,
     IUserService userService,
     IPhotoService photoService,
     IMapper mapper)
 {
     this._mapper             = mapper;
     this._userService        = userService;
     this._hostingEnvironment = environment;
     this._context            = context;
     this._photoService       = photoService;
 }
示例#3
0
        static void Main(string[] args)
        {
            Mapper.Initialize(
                cfg =>
            {
                cfg.AddProfile <AutoMapperProfile>();
            });
            Directory.SetCurrentDirectory("../../..");
            using (var db = new HipstagramContext())
            {
                IUserService  service      = new UserService(db);
                IPhotoService photoService = new PhotoService(new HostingEnvironment(), db, Mapper.Instance);
                var           x            = photoService.GetUserPhotos(new User {
                    Id = 1
                }).ToList();

                IGalleryService galleryService = new GalleryService(db, photoService);

                //var gallery = new Gallery { Name = "XD2" };
                var user = new User {
                    Id = 1
                };
                //gallery.Owners = new List<UserGalleries> { new UserGalleries { User = user, Gallery = gallery } };
                //galleryService.AddGallery(user, gallery);
                var galleries = galleryService.GetUserAll(user);
                galleryService.AddPhotos(Mapper.Map <GalleryDto>(galleries.FirstOrDefault()), new PhotoDto {
                    Id = 1
                });
                //photoService.GetFromGallery()
                //////gallery.Photos = new List<GalleryPhotos> {new GalleryPhotos{Gallery = gallery, Photo = userPhotos.First()}};
                ////galleryService.AddGallery(gallery);
                //galleryService.AddPhotos(Mapper.Map<GalleryDto>(new Gallery{Id = 5}), new PhotoDto{Id = 1});
                //var photos = photoService.GetFromGallery(new Gallery { Id = 5 });
                //foreach (Photo photo in photos)
                //{
                //    Console.Write(photo.Title + " " + photo.Description);
                //}
                Console.Write("End");
            }
        }
示例#4
0
 public LogsController(HipstagramContext context)
 {
     this._context = context;
 }
示例#5
0
 public UsersController(HipstagramContext context, IUserService userService, IMapper mapper)
 {
     _mapper      = mapper;
     _userService = userService;
     _context     = context;
 }
示例#6
0
 public GalleryService(HipstagramContext context, IPhotoService photoService)
 {
     this._context      = context;
     this._photoService = photoService;
 }
示例#7
0
 public PhotoService(IHostingEnvironment environment, HipstagramContext context, IMapper mapper)
 {
     this._mapper             = mapper;
     this._hostingEnvironment = environment;
     this._context            = context;
 }
示例#8
0
 public UserService(HipstagramContext context)
 {
     this._context = context;
 }