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

            if (selectedMake == null)
            {
                return(NotFound());
            }
            var deletedMake = await vehicleMakeService.DeleteAsync(id);

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> Delete(Guid id)
        {
            var result = await _vehicleMakeService.DeleteAsync(id);

            if (!result.Success)
            {
                return(BadRequest(result.Message));
            }


            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                await VehicleMakeService.DeleteAsync(id);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
コード例 #4
0
        public async Task <ActionResult> Delete(int id, VehicleMakeDTO collection)
        {
            try
            {
                await _vehicleMakeService.DeleteAsync(id);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #5
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            try
            {
                await MakeService.DeleteAsync(id);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
コード例 #6
0
        public async Task <IActionResult> DeleteAsync(Guid id)
        {
            var result = await _vehicleMakeService.DeleteAsync(id);

            if (!result.Success)
            {
                return(BadRequest(result.Message));
            }

            var vehicleMakeResource = _mapper.Map <VehicleMake, VehicleMakeResource>(result.VehicleMake);

            return(Ok(vehicleMakeResource));
        }
コード例 #7
0
        public async Task <ActionResult> Delete(VehicleMakeViewModel model)
        {
            var vehicle = Mapper.Map <VehicleMakeViewModel, VehicleMake>(model);

            Mapper.AssertConfigurationIsValid();
            if (vehicle != null)
            {
                await vehiclemakeService.DeleteAsync(vehicle.Id);

                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
コード例 #8
0
        public async Task <IHttpActionResult> Delete(int id)
        {
            try
            {
                Caching.InvalidateCache(MasterCacheKeyArray);
                await VehicleMakeService.DeleteAsync(id);

                return(Ok());
            }
            catch (Exception ex)
            {
                LogError.LogError(ex);
                return(BadRequest(ex.Message));
            }
        }
コード例 #9
0
        public async Task <ActionResult> DeleteConfirmedAsync(Guid id)
        {
            try
            {
                if (id != null)
                {
                    await service.DeleteAsync(id);

                    return(RedirectToAction(""));
                }
                else
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
                }
            }
            catch (Exception ex)
            {
                // throw ex;
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, ex.Message));
            }
        }