Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id,
                                               DriveCreateEditViewModel model,
                                               [FromServices] IDriveHelperService driveHelperService,
                                               [FromServices] IDrivesService drivesService,
                                               [FromServices] UserManager <ApplicationUser> userManager,
                                               [FromServices] ICarsService carsService)
        {
            int userId = int.Parse(userManager.GetUserId(User));

            if (this.ModelState.IsValid)
            {
                try
                {
                    await driveHelperService.ProcessEditDriveAsync(model, id);

                    return(Json(new { success = "true", message = "Drive successfully edited." }));
                }
                catch (Exception ex)
                {
                    return(Json(new { success = "false", message = "An error has occured." }));
                }
            }

            var cars = carsService.GetSelectionListByDriver(userId);

            model.Cars = cars;
            return(this.PartialView("_EditPartial", model));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// The user renews access token and refresh token
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='renewTokenRequest'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <AccessTokenResponse> RenewTokenAsync(this ICarsService operations, RenewTokenRequest renewTokenRequest, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.RenewTokenWithHttpMessagesAsync(renewTokenRequest, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Ejemplo n.º 3
0
 public CarsController(UserManager <ApplicationUser> userManager, ICarsService carsService, IConfiguration configuration)
 {
     this.userManager     = userManager;
     this.carsService     = carsService;
     this.configuration   = configuration;
     this.imagePathPrefix = string.Format(this.cloudinaryPrefix, this.configuration["Cloudinary:AppName"]);
 }
Ejemplo n.º 4
0
 public InvoicesController(IInvoicesService invoicesService, IUsersService usersService, ICarsService carsService, UserManager <ApplicationUser> userManager)
 {
     this.invoicesService = invoicesService;
     this.usersService    = usersService;
     this.carsService     = carsService;
     this.userManager     = userManager;
 }
Ejemplo n.º 5
0
 public RidesController(ICarsService carsService, IRidesService ridesService,
                        IInvitationsService invitationsService)
 {
     this.carsService        = carsService;
     this.ridesService       = ridesService;
     this.invitationsService = invitationsService;
 }
 public CarsController(ILogger <CarsController> logger, AutomobileDbContext dbContext, ICarsService carsService, UserManager <ApplicationUser> userManager)
 {
     _logger          = logger;
     this.dbContext   = new AutomobileDbContext();
     this.carsService = carsService;
     _userManager     = userManager;
 }
Ejemplo n.º 7
0
 public CarsController(IMakesService makesService, ITransmissionsService transmissionsService, ICarsService carsService, IMapper mapper)
 {
     this.transmissionsService = transmissionsService;
     this.makesService         = makesService;
     this.mapper      = mapper;
     this.carsService = carsService;
 }
Ejemplo n.º 8
0
 public CarsController(
     ICarsService carsService,
     IUsersService usersService)
 {
     this.carsService  = carsService;
     this.usersService = usersService;
 }
Ejemplo n.º 9
0
 public CarsController(
     IValidator validator,
     ICarsService carsService)
 {
     this.validator   = validator;
     this.carsService = carsService;
 }
 public ManageCarsController(
     IManageCarsService manageCarsService,
     ICarsService carsService)
 {
     this.manageCarsService = manageCarsService;
     this.carsService       = carsService;
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Gets a specific file from an execution in carsService.
        /// </summary>
        /// <param name='operations'>
        /// The operations group for this extension method.
        /// </param>
        /// <param name='executionId'>
        /// Execution id of the execution
        /// </param>
        /// <param name='index'>
        /// Index of the execution in the batch.
        /// </param>
        /// <param name='fileName'>
        /// Name of the file to be returned.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        public static async Task <System.IO.Stream> GetBatchExecutionFileAsync(this ICarsService operations, string executionId, int index, string fileName, CancellationToken cancellationToken = default(CancellationToken))
        {
            var _result = await operations.GetBatchExecutionFileWithHttpMessagesAsync(executionId, index, fileName, null, cancellationToken).ConfigureAwait(false);

            _result.Request.Dispose();
            return(_result.Body);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Gets all files from an individual execution in carsService.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='executionId'>
 /// Execution id of the execution
 /// </param>
 /// <param name='index'>
 /// Index of the execution in the batch.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <string> > GetBatchExecutionFilesAsync(this ICarsService operations, string executionId, int index, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetBatchExecutionFilesWithHttpMessagesAsync(executionId, index, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Consume the carsService web service.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='webServiceParameters'>
 /// Input parameters to the web service.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <WebServiceResult> ManualTransmissionAsync(this ICarsService operations, InputParameters webServiceParameters, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ManualTransmissionWithHttpMessagesAsync(webServiceParameters, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Ejemplo n.º 14
0
 public SearchController(
     IAdditionsService additionsService,
     ICarsService carsService)
 {
     this.additionsService = additionsService;
     this.carsService      = carsService;
 }
Ejemplo n.º 15
0
 public HelperController(IMakesService makesService, IModelsService modelsService, IGenerationsService generationsService, ICarsService carsService)
 {
     this.makesService       = makesService;
     this.modelsService      = modelsService;
     this.generationsService = generationsService;
     this.carsService        = carsService;
 }
Ejemplo n.º 16
0
 public CustomerController(
     ICustomerRepository _Customer
     , IContactRepository _Contact
     , IUserRepository _user
     , IProductInvoiceRepository _ProductInvoice
     , IvwProvinceService _ProvinceService
     , IvwDistrictService _DistrictService
     , IvwWardService _IWardService
     , IMemberCardService _MemberCardService
     , IvwCarService _vwCarService
     , ICarLineRepository _CarLine
     , ICarsService _Cars
     , IMemberCardTypeService _MemberCardTypeService
     )
 {
     ContactRepository        = _Contact;
     CustomerRepository       = _Customer;
     userRepository           = _user;
     productInvoiceRepository = _ProductInvoice;
     ProvinceService          = _ProvinceService;
     DistrictService          = _DistrictService;
     WardService           = _IWardService;
     MemberCardService     = _MemberCardService;
     vwCarsService         = _vwCarService;
     CarLineRepository     = _CarLine;
     CarsService           = _Cars;
     MemberCardTypeService = _MemberCardTypeService;
 }
Ejemplo n.º 17
0
 public CarsController(ICarsService carsService, UserManager <ApplicationUser> userManager, IUsersService usersService, ICarUsersService carUsersService)
 {
     this.carsService     = carsService;
     this.userManager     = userManager;
     this.usersService    = usersService;
     this.carUsersService = carUsersService;
 }
Ejemplo n.º 18
0
 public PriceService(ICarsService carsService, IYearDiscount yearDiscount, INumberOfCarsDiscount numberOfCarsDiscount, ITotalAmountDiscount totalAmountDiscount)
 {
     _carsService          = carsService;
     _yearDiscount         = yearDiscount;
     _numberOfCarsDiscount = numberOfCarsDiscount;
     _totalAmountDiscount  = totalAmountDiscount;
 }
Ejemplo n.º 19
0
 public SalesController(
     IWebHostEnvironment webHostEnvironment,
     ICarsService carsService,
     ISalesService salesService,
     ICategoriesService categoriesService,
     IMakesService makesService,
     IModelsService modelsService,
     IFuelTypesService fuelTypesService,
     IEuroStandartsService euroStandartsService,
     IGearboxesService gearboxesService,
     IColorsService colorsService,
     ICountriesService countriessService,
     ICitiesService citiesService,
     UserManager <ApplicationUser> userManager,
     ICaptchaValidator captchaValidator)
 {
     this.webHostEnvironment   = webHostEnvironment;
     this.carsService          = carsService;
     this.salesService         = salesService;
     this.categoriesService    = categoriesService;
     this.makesService         = makesService;
     this.modelsService        = modelsService;
     this.fuelTypesService     = fuelTypesService;
     this.euroStandartsService = euroStandartsService;
     this.gearboxesService     = gearboxesService;
     this.colorsService        = colorsService;
     this.countriesService     = countriessService;
     this.citiesService        = citiesService;
     this.userManager          = userManager;
     this.captchaValidator     = captchaValidator;
 }
Ejemplo n.º 20
0
 public CustomerAddingAd()
 {
     InitializeComponent();
     _adService   = InstanceFactory.GetInstance <IAdService>();
     _cityService = InstanceFactory.GetInstance <ICityService>();
     _carsService = InstanceFactory.GetInstance <ICarsService>();
 }
        public void Init()
        {
            this.ConfigureMapper();
            this.cars = new List <Car>()
            {
                new Car()
                {
                    Id    = 1,
                    Price = 20,
                    Name  = "Volga"
                },
                new Car()
                {
                    Id    = 2,
                    Price = 30,
                    Name  = "Chaika"
                }
            };

            this._context = new FakeCarsDbContext();
            foreach (var car in cars)
            {
                this._context.Cars.Add(car);
            }

            HttpConfiguration config = new HttpConfiguration();

            this._service    = new CarsService(this._context);
            this._controller = new CarsController(this._service);
            this._controller.Configuration = config;
        }
Ejemplo n.º 22
0
        public AllCarsPresenter(IAllCarsViewModel view, ICarsService service)
            : base(view)
        {
            this.service = service;

            this.View.OnCarsGetData += this.View_OnCarsGetData;
        }
Ejemplo n.º 23
0
 public AdminForm()
 {
     InitializeComponent();
     _adService   = InstanceFactory.GetInstance <IAdService>();
     _cityService = InstanceFactory.GetInstance <ICityService>();
     _carsService = InstanceFactory.GetInstance <ICarsService>();
 }
Ejemplo n.º 24
0
        public IActionResult IndexPartial([FromServices] ICarsService carsService,
                                          [FromServices] UserManager <ApplicationUser> userManager)
        {
            int userId = int.Parse(userManager.GetUserId(User));
            var cars   = carsService.GetAllCarsIndex(userId);

            return(this.View("_IndexPartial", cars));
        }
        public void ThrowNullReferenceException_WhenCarsService_IsNull()
        {
            // Arrange
            ICarsService service = null;

            // Act & Assert
            Assert.Throws <NullReferenceException>(() => new AddUserController(service));
        }
 public UserAllRegisteredVehiclesViewComponent(
     ICarsService carsService,
     UserManager <ApplicationUser> userManager, IUsersService usersService)
 {
     this.carsService  = carsService;
     this.userManager  = userManager;
     this.usersService = usersService;
 }
Ejemplo n.º 27
0
 public CarsController(IBodyTypesService bodyTypesService, ICarModelsService carModelsService, ICarsService carsService, UserManager <ApplicationUser> userManager, IWebHostEnvironment environment)
 {
     this.bodyTypesService = bodyTypesService;
     this.carModelsService = carModelsService;
     this.carsService      = carsService;
     this.userManager      = userManager;
     this.environment      = environment;
 }
Ejemplo n.º 28
0
 public CarsController(ILocationsService locationsService, IMapper mapper, ICarsService carsService, Cloudinary cloudinary, IImagesService imagesService)
 {
     this.locationsService = locationsService;
     this.mapper           = mapper;
     this.carsService      = carsService;
     this.cloudinary       = cloudinary;
     this.imagesService    = imagesService;
 }
        public CarDetailsPresenter(ICarDetailsViewModel view, ICarsService carsService, IUsersService usersService)
            : base(view)
        {
            this.carsService  = carsService;
            this.usersService = usersService;

            this.View.OnCarGetData += this.View_OnCarGetData;
        }
        public CustomerDetailsPresenter(ICustomerDetailsViewModel view, IUsersService userService, ICarsService carService)
            : base(view)
        {
            this.userService = userService;
            this.carService  = carService;

            this.View.OnCustomerDetails += this.View_OnCustomerDetails;
        }
        public CarsController(ICarsService carsService) {

            _carsService = carsService;
        }
        public CarsCountService (ICarsService carsService) {

            _carsService = carsService;
	    }
Ejemplo n.º 33
0
 public CarsController(ICarsService carsService)
 {
     if (carsService == null) throw new ArgumentNullException(nameof(carsService));
     this.carsService = carsService;
 }