public void BDDScenario_1_1_TestCarCreation(string make, string model, string engine, int doors, int wheels, CarBodyType bodyType) { IVehicleFactory <Car, CreateCarCommand> factory = new CarFactory(); CreateCarCommand createCarCommand = new CreateCarCommand(make, model, engine, doors, wheels, bodyType); Car car = factory.Create(createCarCommand); Assert.NotNull(car); Assert.Equal(make, car.Make); Assert.Equal(model, car.Model); Assert.Equal(engine, car.Engine); Assert.Equal(doors, car.Doors); Assert.Equal(wheels, car.Wheels); Assert.Equal(bodyType, car.BodyType); }
public Car(int year, string name, int price, CarBodyType type) { Year = year; Name = name; Price = price; BodyType = type; }
protected override ValidationResult IsValid(object bodyType, ValidationContext validationContext) { if (CarBodyType.ToArray().Contains(bodyType)) { return(ValidationResult.Success); } else { return(new ValidationResult("Invalid car body type")); } }
public bool Save(CarBodyType obj, ref string message) { if (obj.TypeId == 0) { return(Add(obj, ref message)); } else { return(Update(obj.TypeId, obj)); } }
public CarBodyTypeViewModel CopyFields(CarBodyType from, CarBodyTypeViewModel to) { if (to == null) { throw new NullReferenceException(); } if (from == null) { throw new NullReferenceException(); } to.Id = from.Id; to.Name = from.Name; return(to); }
public CreateCarCommand(string make, string model, string engine, int doors, int wheels, CarBodyType bodyType) { this.Make = make; this.Model = model; this.Engine = engine; this.Doors = doors; this.Wheels = wheels; this.BodyType = bodyType; }
private Car(string make, string model, string engine, int doors, int wheels, CarBodyType bodyType) : this() { this.Make = make; this.Model = model; this.Engine = engine; this.Doors = doors; this.Wheels = wheels; this.BodyType = bodyType; }
private bool Update(long Id, CarBodyType obj) { bool state = false; var objEx = _uow.BodyTypes.Get(Id); objEx = obj; objEx.TypeId = (int)Id; _uow.BodyTypes.Update(Id, objEx); int result = _uow.Complete(); if (result > 0) { state = true; } return(state); }
private bool Add(CarBodyType obj, ref string message) { bool state = false; // Check if there is an existing name if (!_uow.BodyTypes.IsExists(obj)) { _uow.BodyTypes.Add(obj); int result = _uow.Complete(); if (result > 0) { state = true; } } else { message = "Data Exists!"; } return(state); }
public async Task <IActionResult> AddCarBodyType(string name) { if (!String.IsNullOrEmpty(name)) { try { var carBody = new CarBodyType { Name = name, }; await _dbContext.CarBodyTypes.AddAsync(carBody); await _dbContext.SaveChangesAsync(); return(Json(carBody)); } catch (Exception) { return(Json("fail")); } } return(Json("fail")); }
public Porsche(CarBodyType type) : base(type) { }
public Car(string model, string make, CarBodyType type, int price, int year, int mile, double size, string des, string color, string socure, string img) : base(model, make, price, year, mile, size, des, color, socure, img) { BodyType = type; }
public Ducati(CarBodyType type) : base(type) { }
public bool Remove(CarBodyType obj) { throw new NotImplementedException(); }
public Etron(CarBodyType type) : base(type) { }
public Bentley(CarBodyType type) : base(type) { }
public IActionResult GetBodyTypes() { return(Ok(CarBodyType.ToArray())); }
public Car(string make, string model, decimal price, int year, string color, decimal mileage, string description, BitmapImage image, CarBodyType bodyType) : base(make, model, price, year, color, mileage, description, image) { this.bodyType = bodyType; }
public PorscheMacan(CarBodyType type) : base(type) { }
public AudiRS5(CarBodyType type) : base(type) { }
public VolkswagenGroup(CarBodyType type) { this.bodyType = type; }
public Bugatti(CarBodyType type) : base(type) { }