Esempio n. 1
0
 public ImagesController(IWebHostEnvironment host, IOptionsSnapshot <PhotoSettings> options, IMapper mapper, IUnitOfWork unitOfWork)
 {
     this.host          = host;
     this.mapper        = mapper;
     this.unitOfWork    = unitOfWork;
     this.photoSettings = options.Value;
 }
Esempio n. 2
0
 public PhotosController(IHostingEnvironment host, IUnitOfWork unitOfWork, IMapper mapper, IOptionsSnapshot <PhotoSettings> options)
 {
     this._photoSettings = options.Value;
     _host       = host;
     _unitOfWork = unitOfWork;
     _mapper     = mapper;
 }
Esempio n. 3
0
        public async Task <ResponseHandler> AddPhotoForUser(UserPhotoDto userPhotoDto)
        {
            var user = await _context.Users.Include(x => x.ProfilePicture).FirstOrDefaultAsync(x => x.Id == userPhotoDto.UserId);

            PhotoSettings settings = CloudinarySettings();

            if (user.ProfilePicture != null)
            {
                await DeletePhoto(settings, user.ProfilePicture);
            }

            var photoModel = new PhotoModel(userPhotoDto.File)
            {
                Folder  = "LMS/Members",
                Width   = 500,
                Height  = 500,
                Gravity = "face",
                Crop    = "fill"
            };

            var result = _photoLibrary.UploadPhoto(settings, photoModel);

            userPhotoDto.Url      = result.Url;
            userPhotoDto.PublicId = result.PublicId;

            var photo = _mapper.Map <UserProfilePhoto>(userPhotoDto);

            user.ProfilePicture = photo;

            await _context.SaveChangesAsync();

            var photoToreturn = _mapper.Map <PhotoForReturnDto>(photo);

            return(new ResponseHandler(photoToreturn, photo.Id));
        }
Esempio n. 4
0
        public async Task <ResponseHandler> AddPhotoForAsset(AssetPhotoDto assetPhotoDto)
        {
            var asset = await _context.LibraryAssets.Include(x => x.Photo).FirstOrDefaultAsync(x => x.Id == assetPhotoDto.LibraryAssetId);

            PhotoSettings settings = CloudinarySettings();

            if (asset.Photo != null)
            {
                await DeletePhoto(settings, asset.Photo);
            }

            var photoModel = new PhotoModel(assetPhotoDto.File)
            {
                Folder = "LMS/Assets",
                Width  = 500,
                Height = 500,
                Crop   = "fill"
            };

            var result = _photoLibrary.UploadPhoto(settings, photoModel);

            assetPhotoDto.Url      = result.Url;
            assetPhotoDto.PublicId = result.PublicId;

            var photo = _mapper.Map <AssetPhoto>(assetPhotoDto);

            asset.Photo = photo;

            await _context.SaveChangesAsync();

            var photoToreturn = _mapper.Map <PhotoForReturnDto>(photo);

            return(new ResponseHandler(photoToreturn, photo.Id));
        }
 public PhotosController(IHostingEnvironment host, IPhotoService photoService, VegaDbContext context, IOptionsSnapshot <PhotoSettings> options)
 {
     this.host         = host;
     this.photoService = photoService;
     this.context      = context;
     this.options      = options.Value;
 }
Esempio n. 6
0
 public PhotosController(IHostingEnvironment host, IVehicleRepository repository, IUnitOfWork uow, IMapper mapper, IOptionsSnapshot <PhotoSettings> options)
 {
     this.host          = host;
     this.repository    = repository;
     this.uow           = uow;
     this.mapper        = mapper;
     this.photoSettings = options.Value;
 }
 public PhotosController(IHostingEnvironment host, IMapper mapper, IOptionsSnapshot <PhotoSettings> options, AutoCityDbContext context)
 {
     this.photoSettings = options.Value;
     this.context       = context;
     this.options       = options;
     this.mapper        = mapper;
     this.host          = host;
 }
Esempio n. 8
0
 public PhotoController(ApplicationDbContext context, IHostingEnvironment host, IMapper mapper, IOptionsSnapshot <PhotoSettings> options, IPhotoService photoService)
 {
     this.context      = context;
     this.photoService = photoService;
     photoSettings     = options.Value;
     this.mapper       = mapper;
     this.host         = host;
 }
Esempio n. 9
0
 PhotosController(IHostingEnvironment host, IVehicleRepository vehicleRespository, IUnitOfWork unitOfWork, IMapper mapper, IOptionsSnapshot <PhotoSettings> options)
 {
     this.host = host;
     this.vehicleRespository = vehicleRespository;
     this.unitOfWork         = unitOfWork;
     this.mapper             = mapper;
     this.photoSettings      = options.Value;
 }
Esempio n. 10
0
 public PhotosController(IHostingEnvironment host, ITradeRepository repository, IUnitOfWork unitOfWork, IMapper mapper, IOptionsSnapshot <PhotoSettings> options)
 {
     this.photoSettings = options.Value;
     this.unitOfWork    = unitOfWork;
     this.mapper        = mapper;
     this.repository    = repository;
     this.host          = host;
 }
Esempio n. 11
0
 public PhotosController(IPhotoRepository photoRepo, IHostingEnvironment host, IProductRepository productRepo, IMapper mapper, IOptionsSnapshot <PhotoSettings> options)
 {
     _photoRepo    = photoRepo;
     photoSettings = options.Value;
     _host         = host;
     _productRepo  = productRepo;
     _mapper       = mapper;
 }
 public PhotosController(IVehicleRepository vehicleRepository, IPhotoRepository photoRepository, IUnitOfWork unitOfWork, IOptionsSnapshot <PhotoSettings> options, IPhotoStorage photoStorage)
 {
     _vehicleRepository = vehicleRepository;
     _photoRepository   = photoRepository;
     _unitOfWork        = unitOfWork;
     _photoSettings     = options.Value;
     _photoStorage      = photoStorage;
 }
Esempio n. 13
0
 public EductionalCenterGroupController(IEductionalCenterGroupRepository eductionalCenterGroupRepository,
                                        IOptionsSnapshot <PhotoSettings> options,
                                        IWebHostEnvironment host)
 {
     _eductionalCenterGroupRepository = eductionalCenterGroupRepository;
     this._photoSetting = options.Value; //
     _host = host;
 }
Esempio n. 14
0
 public PhotosController(IHostingEnvironment host, IBookInstRepo repo, IUnitOfWork uow, IMapper mapper, IOptionsSnapshot <PhotoSettings> options, IPhotoRepo photoRepo, IConfiguration config)
 {
     this.photoRepo     = photoRepo;
     this.photoSettings = options.Value;
     this.mapper        = mapper;
     this.uow           = uow;
     this.bookInstRepo  = repo;
     this.host          = host;
 }
Esempio n. 15
0
 public PhotoController(IWebHostEnvironment host, IVehicleRepository repository, IUnitOfWork unitOfWork, IMapper mapper, VegaDbContext context, IOptionsSnapshot <PhotoSettings> options)
 {
     this.unitOfWork    = unitOfWork;
     this.repository    = repository;
     this.context       = context;
     this.mapper        = mapper;
     this.host          = host;
     this.photoSettings = options.Value;
 }
Esempio n. 16
0
 public PhotosController(IWebHostEnvironment host, IVehicleRepository repository, IUnitOfWork unitOfWork, IMapper mapper, IOptionsSnapshot <PhotoSettings> options, IPhotoRepository photoRepository)
 {
     this.photoRepository = photoRepository;
     this.photoSettings   = options.Value;
     this.mapper          = mapper;
     this.unitOfWork      = unitOfWork;
     this.repository      = repository;
     this.host            = host;
 }
Esempio n. 17
0
 public PhotosController(IWebHostEnvironment host, IVehicleRepository vehicleRepository, IPhotoRepository photoRepository, IMapper mapper, IOptionsSnapshot <PhotoSettings> options, IPhotoService photoService)
 {
     this.photoService      = photoService;
     this.photoRepository   = photoRepository;
     this.photoSettings     = options.Value;
     this.mapper            = mapper;
     this.vehicleRepository = vehicleRepository;
     this.host = host;
 }
Esempio n. 18
0
 public PhotoController(IHostingEnvironment host, IVehicleDetailsRepository vehicleDetailsRepo, IUnitOfWork uow, IOptionsSnapshot <PhotoSettings> options, IMapper mapper, IVehiclePhotoRepository vehiclePhotoRepo)
 {
     _host = host;
     _vehicleDetailsRepo = vehicleDetailsRepo;
     _vehiclePhotoRepo   = vehiclePhotoRepo;
     _uow          = uow;
     photoSettings = options.Value;
     _mapper       = mapper;
 }
Esempio n. 19
0
 public PhotosController(IPhotoService photoService, IVehicleService vehicleService,
                         IOptionsSnapshot <PhotoSettings> optionSnapshot,
                         IWebHostEnvironment webHostEnvironment)
 {
     this.photoService       = photoService;
     this.vehicleService     = vehicleService;
     this.webHostEnvironment = webHostEnvironment;
     this.photoSettings      = optionSnapshot.Value;
 }
Esempio n. 20
0
        public PhotoValidator(IOptions <PhotoSettings> photoSettings
                              , IStringLocalizer <CommonValidatorsResource> commonLocalizer)
        {
            _photoSettings   = photoSettings.Value;
            _commonLocalizer = commonLocalizer;

            RuleFor(v => v)
            .Custom(BeValidUploadedPhoto);
        }
Esempio n. 21
0
 public PhotosController(IHostingEnvironment host, IVehicleRepository repository, IUnitOfWork unitOfWork, IMapper mapper, IOptionsSnapshot <PhotoSettings> options, IPhotoRepository photoRepository)
 {
     this.photoSettings = options.Value;
     _host            = host;
     _repository      = repository;
     _unitOfWork      = unitOfWork;
     _mapper          = mapper;
     _photoRepository = photoRepository;
 }
 public PhotosController(IHostingEnvironment host, IRealEstateRepository realEstateRepository, IPhotoRepository photoRepository, IMapper mapper, IOptionsSnapshot <PhotoSettings> options, IPhotoService photoService)
 {
     this.photoService         = photoService;
     this.photoSettings        = options.Value;
     this.mapper               = mapper;
     this.realEstateRepository = realEstateRepository;
     this.photoRepository      = photoRepository;
     this.host = host;
 }
Esempio n. 23
0
 public PhotosController(IHostingEnvironment host, IVehicleRepository vehicleRepository, IPhotoRepository photoRepository, IUnitOfWork unitOfWork, IMapper mapper, IOptionsSnapshot <PhotoSettings> options)
 {
     this.host              = host;
     this.photoRepository   = photoRepository;
     this.vehicleRepository = vehicleRepository;
     this.unitOfWork        = unitOfWork;
     this.mapper            = mapper;
     photoSettings          = options.Value;
     //host.WebRootPath --wwwRoot
 }
Esempio n. 24
0
 public ProfileController(IProfileService profile,
                          IMapper mapper,
                          IOptions <PhotoSettings> options,
                          IBackgroundJobClient backgroundJob)
 {
     _profile       = profile;
     _mapper        = mapper;
     _backgroundJob = backgroundJob;
     _photoSettings = options.Value;
 }
 public CoverService(VideoServiceDbContext context, IMovieService movieService,
                     ILogger <BaseService <Cover, CoverDto> > logger, IMapper mapper, IHostingEnvironment host,
                     IOptionsSnapshot <PhotoSettings> options) : base(context, logger, mapper)
 {
     _movieService  = movieService;
     _logger        = logger;
     _mapper        = mapper;
     _host          = host;
     _photoSettings = options.Value;
 }
 public EductionalCenterController(IEductionalCenterRepository eductionalCenterRepository,
                                   IOptionsSnapshot <PhotoSettings> options,
                                   IWebHostEnvironment host,
                                   IConfiguration configuration)
 {
     _eductionalCenterRepository = eductionalCenterRepository;
     this._photoSetting          = options.Value; //
     _host          = host;
     _configuration = configuration;
 }
 public ManageController(UserManager <AppUser> userManager,
                         SignInManager <AppUser> signInManager,
                         IEmailSender emailSender, IFileManager fileManager, IOptionsSnapshot <PhotoSettings> options)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _emailSender   = emailSender;
     _fileManager   = fileManager;
     _options       = options.Value;
 }
Esempio n. 28
0
 public TeacherController(ITeacherRegisterRepository teacherRegisterRepository,
                          IOptionsSnapshot <PhotoSettings> options,
                          IWebHostEnvironment host,
                          IConfiguration configuration)
 {
     _teacherRegisterRepository = teacherRegisterRepository;
     _photoSetting  = options.Value; //
     _host          = host;
     _configuration = configuration;
 }
Esempio n. 29
0
 public PhotosController(IPhoto photoRepo,
                         ICategoryReporitory categoryRepo, IClientNotification clientNotification,
                         IFileManager fileManager, IOptionsSnapshot <PhotoSettings> options)
 {
     _photoRepo          = photoRepo;
     _categoryRepo       = categoryRepo;
     _clientNotification = clientNotification;
     _fileManager        = fileManager;
     _options            = options.Value;
 }
 public ParentController(IParentRepository parentRepository,
                         IOptionsSnapshot <PhotoSettings> options,
                         IWebHostEnvironment host,
                         IConfiguration configuration)
 {
     _parentRepository  = parentRepository;
     this._photoSetting = options.Value; //
     _host          = host;
     _configuration = configuration;
 }