Esempio n. 1
0
        private void btnSil_Click(object sender, EventArgs e)
        {
            var controlcar = carServices.Control((cmbModelAdı.SelectedValue as Model).Name, tbMarkaAdi.Text,
                                                 (cmbKasaTipi.SelectedValue as VehicleBody), (cmbRenk.SelectedValue as Core.Entities.Color),
                                                 (cmbYil.SelectedValue as Year).Years);

            if (controlcar > 0)
            {
                MessageBox.Show(Error.UserError.ErrorMessage(Convert.ToInt32(Error.UserError.ErrorCode.KayitOncedenEklenmis)));
            }
            else
            {
                var deleteID = carServices.Find(Convert.ToInt32(dgvAracData.CurrentRow.Cells[0].Value.ToString()));
                if (deleteID != null)
                {
                    var delete = carServices.Delete(deleteID);
                    if (delete > 0)
                    {
                        MessageBox.Show(Error.UserError.ErrorMessage(Convert.ToInt32(Error.UserError.ErrorCode.KayitSilindi)));
                        dgvAracData.DataSource = carServices.Select();
                    }
                    else
                    {
                        MessageBox.Show(Error.UserError.ErrorMessage(Convert.ToInt32(Error.UserError.ErrorCode.KayitSilinmedi)));
                        dgvAracData.DataSource = carServices.Select();
                    }
                }
                else
                {
                    MessageBox.Show(Error.UserError.ErrorMessage(Convert.ToInt32(Error.UserError.ErrorCode.KayitBulunamadı)));
                }
            }
        }
Esempio n. 2
0
        public ActionResult <ResponseCRUDMessage> Delete(int id)
        {
            var carDeleted = carService.Delete(id);

            if (carDeleted.status)
            {
                return(Ok(carDeleted));
            }
            return(NotFound(carDeleted));
        }
        public IActionResult Delete(int id)
        {
            var delete = _carServices.Delete(id);

            if (!delete)
            {
                return(NotFound());
            }

            return(NoContent());
        }
 protected void submitBtn_Click(object sender, EventArgs e)
 {
     carServicesObj.Delete(carServicesObj.GetById(Guid.Parse(idTxtBox.Text)));
     Response.Redirect("CarWebPageView.aspx");
 }
Esempio n. 5
0
        public void Select(Car selectedCar)
        {
            bool exit = false;

            while (!exit)
            {
                Console.WriteLine("\nSelected Car:");
                PrintInfo(selectedCar, false);
                Console.WriteLine("Choose an option:");
                Console.WriteLine("\t1. Edit");
                Console.WriteLine("\t2. Delete");
                Console.WriteLine("\t3. Calculate fuel");
                Console.WriteLine("\t4. Refuel");
                Console.WriteLine("\t5. Passengers");
                Console.WriteLine("\t6. Back");

                switch (Console.ReadKey(true).KeyChar)
                {
                case '1':
                    CarEditConsoleView carEditConsoleView = new CarEditConsoleView(selectedCar);
                    selectedCar = carServicesObj.Update(carEditConsoleView.Load());
                    break;

                case '2':
                    Console.Write("Type vehicle name to confirm:");
                    if (Console.ReadLine() == selectedCar.vehicleName)
                    {
                        carServicesObj.Delete(selectedCar);
                        exit = true;
                    }
                    else
                    {
                        Console.WriteLine("Cancelled");
                    }
                    break;

                case '3':
                    Console.Write("Enter distance in miles: ");
                    Distance distance = new Distance();
                    distance.miles = Convert.ToDecimal(Console.ReadLine());
                    selectedCar    = carServicesObj.CalculateFuel(selectedCar, distance);
                    break;

                case '4':
                    selectedCar = carServicesObj.Refuel(selectedCar);
                    break;

                case '5':
                    CarPassengerConsoleView carPassengers = new CarPassengerConsoleView(selectedCar);
                    carPassengers.Load();
                    break;

                case '6':
                    exit = true;
                    break;

                default:
                    Console.WriteLine("Invalid input");
                    break;
                }
            }
        }
Esempio n. 6
0
 private void deleteButton_Click(object sender, System.EventArgs e)
 {
     carServicesObj.Delete(GetSelectedCar());
     FillCarList();
 }