internal Car Delete(int id) { Car original = Get(id); _repo.Delete(id); return(original); }
//delete car public void Delete(string num) { using (CarsRepository carsRepository = new CarsRepository()) { carsRepository.Delete(num); } }
internal CarListing Delete(int id) { CarListing original = Get(id); _repo.Delete(id); return(original); }
internal object Delete(int carId) { Car original = Get(carId); _repo.Delete(carId); return(original); }
public ActionResult Delete(int id) { CarsRepository repo = new CarsRepository(); repo.Delete(id); return(RedirectToAction("Index", "Cars")); }
public async Task <IHttpActionResult> DeleteCar(string id) { Car car = await repo.Delete(id); if (car == null) { return(NotFound()); } return(Ok(Mapper.Map <CarDTO>(car))); }
public string Delete(string userId, int id) { GetById(id); bool delorted = _repo.Delete(userId, id); if (!delorted) { throw new Exception("Oops ALL BERRIES You are not the owner of this car"); } return("Delorted!"); }
internal string Delete(int id, string userId) { Car foundCar = GetById(id); if (foundCar.UserId != userId) { throw new Exception("This is not your car!"); } if (_repo.Delete(id, userId)) { return("Sucessfully delorted."); } throw new Exception("Somethin bad happened"); }
internal string Delete(int id, string userId) { Car foundCar = GetById(id); if (foundCar.UserId != userId) { throw new Exception("not your car"); } if (_repo.Delete(id, userId)) { return("deleted."); } throw new Exception("ooopps"); }
internal void Delete(int id, string creatorId) { Car car = GetById(id); if (car.CreatorId != creatorId) { throw new Exception("You cannot delete another users Car"); } if (!_repo.Delete(id)) { throw new Exception("Something has gone terribly wrong"); } ; }
public void ZZZZ_ClassCleanUp() { if (con != null) { ownerCarsRepository.DeleteAndFlush(OwnerCar2.PrimaryKey); ownersRepository.DeleteAndFlush(Owner2.PrimaryKey); carsRepository.Refresh(); carsRepository.Delete(Car1.PrimaryKey); carsRepository.Delete(Car2.PrimaryKey); carsRepository.Delete(Car3.PrimaryKey); carsRepository.Delete(Car4.PrimaryKey); carsRepository.Delete(Car5.PrimaryKey); carsRepository.Delete(Car6.PrimaryKey); carsRepository.Delete(Car7.PrimaryKey); carsRepository.Delete(Car8.PrimaryKey); carsRepository.Delete(Car9.PrimaryKey); carsRepository.Delete(Car10.PrimaryKey); carsRepository.Delete(Car11.PrimaryKey); carsRepository.Delete(Car12.PrimaryKey); carsRepository.Delete(Car13.PrimaryKey); carsRepository.Delete(Car14.PrimaryKey); carsRepository.Delete(Car15.PrimaryKey); carsRepository.Flush(); manufacturersRepository.Refresh(); manufacturersRepository.Delete(Manufacturer1.PrimaryKey); manufacturersRepository.Delete(Manufacturer2.PrimaryKey); manufacturersRepository.Delete(Manufacturer3.PrimaryKey); manufacturersRepository.Delete(Manufacturer4.PrimaryKey); manufacturersRepository.Delete(Manufacturer5.PrimaryKey); manufacturersRepository.Delete(Manufacturer6.PrimaryKey); manufacturersRepository.Delete(Manufacturer7.PrimaryKey); manufacturersRepository.Delete(Manufacturer8.PrimaryKey); manufacturersRepository.Delete(Manufacturer9.PrimaryKey); manufacturersRepository.Flush(); countriesRepository.Refresh(); countriesRepository.Delete(Country1.PrimaryKey); countriesRepository.Delete(Country2.PrimaryKey); countriesRepository.Delete(Country3.PrimaryKey); countriesRepository.Delete(Country4.PrimaryKey); countriesRepository.Delete(Country5.PrimaryKey); countriesRepository.Flush(); regionsRepository.Refresh(); regionsRepository.Delete(Region1.PrimaryKey); regionsRepository.Delete(Region2.PrimaryKey); regionsRepository.Delete(Region3.PrimaryKey); regionsRepository.Flush(); con.Close(); } }
public void A430_Delete15Cars() { carsRepository.Refresh(); carsRepository.Delete(Car1.PrimaryKey); carsRepository.Delete(Car2.PrimaryKey); carsRepository.Delete(Car3.PrimaryKey); carsRepository.Delete(Car4.PrimaryKey); carsRepository.Delete(Car5.PrimaryKey); carsRepository.Delete(Car6.PrimaryKey); carsRepository.Delete(Car7.PrimaryKey); carsRepository.Delete(Car8.PrimaryKey); carsRepository.Delete(Car9.PrimaryKey); carsRepository.Delete(Car10.PrimaryKey); carsRepository.Delete(Car11.PrimaryKey); carsRepository.Delete(Car12.PrimaryKey); carsRepository.Delete(Car13.PrimaryKey); carsRepository.Delete(Car14.PrimaryKey); carsRepository.Delete(Car15.PrimaryKey); carsRepository.Flush(); }
static void Main(string[] args) { Console.OutputEncoding = System.Text.Encoding.UTF8; Console.WriteLine("Выберите номер сортировки:\n" + "1)Чтобы создать машину нажмите 1;\n" + "2)Чтобы удалить машину нажмите 2\r\n" + "3)Чтобы изменить машину нажмите 3\r\n" + "4)Чтобы изменить вывести машину нажмите 4\r\n" + "5)Чтобы изменить вывести машину нажмите 5\r\n"); int symbol = Convert.ToInt32(Console.ReadLine()); if (symbol == 1) { string mark; string model; string transmission; int mechanics; string color; string wheelrims; int Disk; string steel; bool Roof; string CarType; string Type; Console.WriteLine("Введите марку машины"); mark = Console.ReadLine(); Console.WriteLine("Введите модель машины"); model = Console.ReadLine(); Console.WriteLine("Введите коробку передач"); transmission = Console.ReadLine(); Console.WriteLine("Введите количество передач"); mechanics = int.Parse(Console.ReadLine()); Console.WriteLine("Введите цвет машины"); color = Console.ReadLine(); Console.WriteLine("Введиnt название дисков"); wheelrims = Console.ReadLine(); Console.WriteLine("Введите ширину дисков"); Disk = int.Parse(Console.ReadLine()); Console.WriteLine("Введите материал изготовления"); steel = Console.ReadLine(); Console.WriteLine("Есть наличие крышы"); Roof = bool.Parse(Console.ReadLine()); if (Roof) { Console.WriteLine("есть"); } else { Console.WriteLine("нету"); } Console.WriteLine("Введите тип машины"); CarType = Console.ReadLine(); Console.WriteLine("Введите тип двигателя"); Type = Console.ReadLine(); CarsProject.models.Type c = models.Type.ElectricEngine; if (Type == "GasEngine") { c = models.Type.GasEngine; } else if (Type == "ElectricEngine") { c = models.Type.ElectricEngine; } else if (Type == "DiselEngine") { c = models.Type.DiselEngine; } CreateCar(mark, model, transmission, mechanics, color, wheelrims, Disk, steel, Roof, CarType, c); } else if (symbol == 2) { Console.WriteLine("Введите id машины которую хотите удалить"); string number = Console.ReadLine(); int CarId = int.Parse(number); CarsRepository Cars = new CarsRepository(); Cars.Delete(CarId); } else if (symbol == 3) { string steel; bool Roof; string transmission; int mechanics; string color; string type; string wheelRims; int diskSize; string mark; string model; Console.WriteLine("Введите id машины которую хотите машины которую хотите изменить"); string number = Console.ReadLine(); int CarId = int.Parse(number); Console.WriteLine("Введите номер новой марки машины"); mark = Console.ReadLine(); Console.WriteLine("Введите номер новой модель машины"); model = Console.ReadLine(); Console.WriteLine("Введите материал изготовления"); steel = Console.ReadLine(); Console.WriteLine("Есть наличие крыши"); Roof = bool.Parse(Console.ReadLine()); if (Roof) { Console.WriteLine("есть"); } else { Console.WriteLine("нету"); } Console.WriteLine("Введите коробку передач"); transmission = Console.ReadLine(); Console.WriteLine("Введите количество передач"); mechanics = int.Parse(Console.ReadLine()); Console.WriteLine("Введите цвет машины"); color = Console.ReadLine(); Console.WriteLine("Введите тип машины"); type = Console.ReadLine(); CarsProject.models.Type c = models.Type.ElectricEngine; if (type == "GasEngine") { c = models.Type.GasEngine; } else if (type == "ElectricEngine") { c = models.Type.ElectricEngine; } else if (type == "DiselEngine") { c = models.Type.DiselEngine; } Console.WriteLine("Введите название дисков"); wheelRims = Console.ReadLine(); Console.WriteLine("Введите размер дисков"); diskSize = int.Parse(Console.ReadLine()); CarsRepository UpdateCar = new CarsRepository(); UpdateCar.Update(CarId, steel, Roof, transmission, mechanics, color, c, wheelRims, diskSize, mark, model); } else if (symbol == 4) { CarsRepository carsRepo = new CarsRepository(); IEnumerable <Car> cars = carsRepo.Get(); foreach (var car in cars) { Console.WriteLine($"{car.CarId} | {car.Mark} | {car.Model} | {car.Body.Steel} | {car.Body.СarRoof} | {car.Box.Transmission} | {car.Box.Mechanics} | {car.Engine.Color} | {car.Engine.Type} | {car.Wheels.DiskSize} | {car.Wheels.WheelRims}"); } } Console.ReadKey(); }