コード例 #1
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var repairStatus = await _repairStatusService.GetAsync(id);

                if (repairStatus != null)
                {
                    await _repairStatusService.DeleteAsync(repairStatus);
                }
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(View("Error", ex));
            }
        }
コード例 #2
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var carBrand = await _repairStatusService.GetAsync(id);

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

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