/***************************************************************************/ public void AddCarModel(AddCarModelModel model) { var inCarBrandId = new SqlParameter { ParameterName = "CarBrandId", Value = model.CarBrandId, DbType = System.Data.DbType.Int64, Direction = System.Data.ParameterDirection.Input }; var inCarModelName = new SqlParameter { ParameterName = "CarModelName", Value = model.Name, DbType = System.Data.DbType.String, Direction = System.Data.ParameterDirection.Input }; var sql = "exec AddCarModel @CarBrandId, @CarModelName"; using (var dbContext = new CarsContext()) { _ = dbContext.Database.ExecuteSqlCommand(sql, inCarBrandId, inCarModelName); } }
private void AddCarModel(CarsRepository repository, long carBrandId, string carBrandModelName) { var carModelModel = new AddCarModelModel(carBrandId, carBrandModelName); repository.AddCarModel(carModelModel); }