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; }
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; }
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"); } }
public LogsController(HipstagramContext context) { this._context = context; }
public UsersController(HipstagramContext context, IUserService userService, IMapper mapper) { _mapper = mapper; _userService = userService; _context = context; }
public GalleryService(HipstagramContext context, IPhotoService photoService) { this._context = context; this._photoService = photoService; }
public PhotoService(IHostingEnvironment environment, HipstagramContext context, IMapper mapper) { this._mapper = mapper; this._hostingEnvironment = environment; this._context = context; }
public UserService(HipstagramContext context) { this._context = context; }