コード例 #1
0
        public IActionResult Delete(int id, FuelViewModel fuelmodel)
        {
            var fuel = new Fuel
            {
                Id = fuelmodel.Id
            };

            try
            {
                _apiGetCalls.DeleteApiCall(fuel, id);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #2
0
        public IActionResult DeleteModel(int id)
        {
            try
            {
                var carModel = _modelApiCall.GetT(id);

                _modelApiCall.DeleteApiCall(carModel, id);


                TempData["SuccessResultF"] = true;
                TempData["SuccessResultM"] = "Model deleted successfully";
                return(RedirectToAction("Models", new { brandId = carModel.BrandId }));
            }
            catch (Exception)
            {
                TempData["SuccessResultF"] = false;
                TempData["SuccessResultM"] = "Something went wrong.";
                throw;
            }
        }
コード例 #3
0
        public IActionResult DeleteBrand(int brandid)
        {
            try
            {
                var brand = _brandApiCall.GetT(brandid);
                _brandApiCall.DeleteApiCall(brand, brandid);



                TempData["SuccessResultF"] = true;
                TempData["SuccessResultM"] = "Brand deleted successfully";
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                TempData["SuccessResultF"] = false;
                TempData["SuccessResultM"] = "Something went wrong.";
                throw ex;
            }
        }
コード例 #4
0
        public ActionResult DeleteLocation(int id)
        {
            try
            {
                var location = _locationApiCall.GetT(id);

                _locationApiCall.DeleteApiCall(location, id);


                TempData["SuccessResultF"] = true;
                TempData["SuccessResultM"] = "Location deleted successfully";

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                TempData["SuccessResultF"] = false;
                TempData["SuccessResultM"] = "Something went wrong.";
                throw ex;
            }
        }