Example #1
0
        public async Task <ActionResult> Delete(Guid id)
        {
            try
            {
                await _carModelService.DeleteAsync(id);

                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest(e));
            }
        }
Example #2
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var carModel = await _carModelService.GetAsync(id);

                if (carModel != null)
                {
                    await _carModelService.DeleteAsync(carModel);
                }
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(View("Error", ex));
            }
        }
Example #3
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var carBrand = await _carModelService.GetAsync(id);

                if (carBrand != null)
                {
                    var result = await _carModelService.DeleteAsync(carBrand);

                    if (result == -1)
                    {
                        return(BadRequest("Error delete"));
                    }
                }
                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }