Example #1
0
            // $G$ CSS-013 (-5) Bad variable name (should be in the form of: i_CamelCase).
            public static string AsText(NumberOfDoors i_eNumberOfDoors)
            {
                string enumDescripton = "null";

                switch (i_eNumberOfDoors)
                {
                case NumberOfDoors.Two:
                {
                    enumDescripton = "Two";
                    break;
                }

                case NumberOfDoors.Three:
                {
                    enumDescripton = "Three";
                    break;
                }

                case NumberOfDoors.Four:
                {
                    enumDescripton = "Four";
                    break;
                }

                case NumberOfDoors.Five:
                {
                    enumDescripton = "Five";
                    break;
                }
                }

                return(enumDescripton);
            }
Example #2
0
        // unique db key = Id

        public Car(DateTime uploadDate, int price, string brand, string model, bool used, YearMonth dateOfPurchase, Engine engine, FuelType fuelType,
                   ChassisType chassisType, string color, GearboxType gearboxType, int totalKilometersDriven, DriveWheels driveWheels, List <string> defects,
                   SteeringWheelPosition steeringWheelPosition, NumberOfDoors numberOfDoors, int numberOfCylinders, int numberOfGears, int seats, YearMonth nextVehicleInspection,
                   string wheelSize, int weight, EuroStandard euroStandard, string originalPurchaseCountry, string vin, List <string> additionalProperties, List <string> images, string comment)
        {
            Price                   = price;
            UploadDate              = uploadDate;
            Brand                   = brand;
            Model                   = model;
            Used                    = used;
            DateOfPurchase          = dateOfPurchase;
            Engine                  = engine;
            FuelType                = fuelType;
            ChassisType             = chassisType;
            Color                   = color;
            GearboxType             = gearboxType;
            TotalKilometersDriven   = totalKilometersDriven;
            DriveWheels             = driveWheels;
            Defects                 = defects;
            SteeringWheelPosition   = steeringWheelPosition;
            NumberOfDoors           = numberOfDoors;
            NumberOfCylinders       = numberOfCylinders;
            NumberOfGears           = numberOfGears;
            Seats                   = seats;
            NextVehicleInspection   = nextVehicleInspection;
            WheelSize               = wheelSize;
            Weight                  = weight;
            EuroStandard            = euroStandard;
            OriginalPurchaseCountry = originalPurchaseCountry;
            Vin = vin;
            AdditionalProperties = additionalProperties;
            Images  = images;
            Comment = comment;
        }
        protected override ICommandResult ExecuteAction(CreateCarDoorModel item)
        {
            NumberOfDoors model = this.mapping.Map <NumberOfDoors>(item);

            NumberOfDoors result = this.service.Save(model);

            return(this.Success(result));
        }
        protected override ICommandResult ExecuteAction(EditCarDoorsModel item)
        {
            NumberOfDoors model = this.mapping.Map <NumberOfDoors>(item);

            if (this.service.Delete(model))
            {
                return(this.Success());
            }

            return(this.Error());
        }
Example #5
0
        public override string ToString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat(
                @"Car color : {0}:
Number of doors : {1}
", m_CarColor.ToString(), NumberOfDoors.ToString());

            return(base.ToString() + stringBuilder.ToString());
        }
        protected override ICommandResult ExecuteAction(EditCarDoorsModel item)
        {
            NumberOfDoors dbDoors = this.service.GetById(item.ID);

            if (dbDoors == null)
            {
                return(this.Error(item.ID));
            }

            dbDoors = this.mapping.Map(item, dbDoors);

            NumberOfDoors result = this.service.Save(dbDoors);

            return(this.Success(result));
        }
Example #7
0
 public CarBuilder WithDoors(NumberOfDoors numberOfDoors)
 {
     _car.NumberOfDoors = numberOfDoors;
     return(this);
 }