public VehicleData Create(Vehicle vehicle) { var vehicleData = new VehicleData { Brand = vehicle.Brand, Color = vehicle.Color, NumberPlate = vehicle.NumberPlate, AdditionalFeatures = vehicle.AdditionalFeatures }; return vehicleData; }
public VehicleData Create(Vehicle vehicle) { var vehicleData = new VehicleData { Brand = vehicle.Brand, Color = vehicle.Color, NumberPlate = vehicle.NumberPlate, AdditionalFeatures = vehicle.AdditionalFeatures }; return(vehicleData); }
private VehicleData Modify(VehicleData vehicleData, JToken json) { var data = vehicleData ?? new VehicleData(); data.AdditionalFeatures = json["additionalFeatures"] != null?json.Value <string>("additionalFeatures") : data.AdditionalFeatures; data.Brand = json["brand"] != null?json.Value <string>("brand") : data.Brand; data.Color = json["color"] != null?json.Value <string>("color") : data.Color; data.NumberPlate = json["numberPlate"] != null?json.Value <string>("numberPlate") : data.NumberPlate; return(data); }
private ICollection <VehicleData> ModifyVehicles(JToken json) { var vehicles = new List <VehicleData>(); foreach (var vehicleJson in json) { var vehicle = new VehicleData { Brand = vehicleJson.Value <string>("brand"), AdditionalFeatures = vehicleJson.Value <string>("additionalFeatures"), Color = vehicleJson.Value <string>("color"), NumberPlate = vehicleJson.Value <string>("numberPlate") }; var vehicleType = new CultureInfo("en-US", false).TextInfo.ToTitleCase(vehicleJson.Value <string>("vehicleType") ?? "Other"); vehicle.VehicleType = (VehicleTypeEnum)Enum.Parse(typeof(VehicleTypeEnum), vehicleType); vehicles.Add(vehicle); } return(vehicles); }
private VehicleData Modify(VehicleData vehicleData, JToken json) { var data = vehicleData ?? new VehicleData(); data.AdditionalFeatures = json["additionalFeatures"] != null ? json.Value<string>("additionalFeatures") : data.AdditionalFeatures; data.Brand = json["brand"] != null ? json.Value<string>("brand") : data.Brand; data.Color = json["color"] != null ? json.Value<string>("color") : data.Color; data.NumberPlate = json["numberPlate"] != null ? json.Value<string>("numberPlate") : data.NumberPlate; var vehicleTypeString = json["vehicleType"] != null ? json.Value<string>("vehicleType") : null; data.VehicleType = vehicleTypeString != null ? (VehicleTypeEnum) Enum.Parse(typeof (VehicleTypeEnum), vehicleTypeString, true) : VehicleTypeEnum.Other; return data; }
public VehicleData Modify(VehicleData vehicleData, JToken json) { var data = vehicleData ?? new VehicleData(); data.AdditionalFeatures = json["additionalFeatures"] != null ? json.Value<string>("additionalFeatures") : data.AdditionalFeatures; data.Brand = json["brand"] != null ? json.Value<string>("brand") : data.Brand; data.Color = json["color"] != null ? json.Value<string>("color") : data.Color; data.NumberPlate = json["numberPlate"] != null ? json.Value<string>("numberPlate") : data.NumberPlate; return data; }