public async Task <IActionResult> PutAutoBrand([FromRoute] int id, [FromBody] AutoBrand autoBrand) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != autoBrand.Id) { return(BadRequest()); } _context.Entry(autoBrand).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AutoBrandExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostAutoBrand([FromBody] AutoBrand autoBrand) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.AutoBrands.Add(autoBrand); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAutoBrand", new { id = autoBrand.Id }, autoBrand)); }
public VehicleBase(Guid id, string stateCarNumber, AutoBrand autoBrand, string name, DateTime produced, double price, int maximumSpeed, FuelType fuelType, double consumption, int mileage) { Id = id; StateCarNumber = stateCarNumber; AutoBrand = autoBrand; Name = name; Produced = produced; Price = price; MaximumSpeed = maximumSpeed; FuelType = fuelType; Сonsumption = consumption; Mileage = mileage; }
public PassengerVehicle(Guid id, string stateCarNumber, AutoBrand autoBrand, string name, DateTime produced, double price, int maximumSpeed, FuelType fuelType, double consumption, int mileage, int passengerNumber) : base(id, stateCarNumber, autoBrand, name, produced, price, maximumSpeed, fuelType, consumption, mileage) { Id = id; StateCarNumber = stateCarNumber; AutoBrand = autoBrand; Name = name; Produced = produced; Price = price; MaximumSpeed = maximumSpeed; FuelType = fuelType; Сonsumption = consumption; Mileage = mileage; PassengerNumber = passengerNumber; }
public Truck(Guid id, string stateCarNumber, AutoBrand autoBrand, string name, DateTime produced, double price, int maximumSpeed, FuelType fuelType, double consumption, int mileage, double cargo, int trunkLenght, int trunkHeight, int trunkWeight) : base(id, stateCarNumber, autoBrand, name, produced, price, maximumSpeed, fuelType, consumption, mileage) { Id = id; StateCarNumber = stateCarNumber; AutoBrand = autoBrand; Name = name; Produced = produced; Price = price; MaximumSpeed = maximumSpeed; FuelType = fuelType; Сonsumption = consumption; Mileage = mileage; Cargo = cargo; TrunkLenght = trunkLenght; TrunkHeight = trunkHeight; TrunkWeight = trunkWeight; }
public static AutoBrandDto ToDto(this AutoBrand model) { return(MapperBLL.Map <AutoBrand, AutoBrandDto>(model)); }