public Vehicle(string brand, string model, Color color, LicensePlate licensePlate, VehicleType type) { if (string.IsNullOrWhiteSpace(brand)) { throw new BrandShouldNotBeEmptyException("Brand should not be empty"); } Brand = brand; if (string.IsNullOrWhiteSpace(model)) { throw new ModelShouldNotBeEmptyException("Model should not be empty"); } Model = model; Color = color; LicensePlate = licensePlate; Type = type; }
public Data.Vehicle ToDataEntity(int?id = null) { return(new Data.Vehicle(id ?? Id, Brand, Model, Color.ToString(), LicensePlate.ToString(), VehicleType.Car)); }