public ActionResult Delete(int id, IFormCollection collection)
        {
            var item = VehicleRentalPriceService.GetById(id);

            try
            {
                var response = VehicleRentalPriceService.Delete(id);
                if (response.IsSuccess)
                {
                    return(RedirectToAction(nameof(Index), new { vehilceId = item.VehicleId }));
                }
                else
                {
                    ViewBag.Response = response;
                }
            }
            catch
            {
                ViewBag.Response = Domain.DTOs.Response.Fail("Bir hata oluştu");
            }
            finally
            {
                SetVehicleToViewBag(item.VehicleId);
            }
            return(View(item));
        }
Ejemplo n.º 2
0
        public ActionResult Delete(VehicleRentalPriceDTO vehiclePrice)
        {
            int      VehicleID = vehiclePrice.VehicleId;
            Response respon    = new Response();

            try
            {
                Response resp = VehicleRentalPriceService.Delete(vehiclePrice.Id);
                ViewBag.Response = resp;
                return(RedirectToAction("Index", "Vehicle"));
            }
            catch
            {
                return(View());
            }
        }