Example #1
0
        public async Task <IActionResult> Delete(int id)
        {
            var result = await _transportService.Delete(id);

            if (result.IsSuccess)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Example #2
0
        public async Task <ActionResult> Delete(int id)
        {
            try
            {
                VerifyUser();
                await _TransportService.Delete(id);

                return(NoContent());
            }
            catch (Exception e)
            {
                var result = new ResultFormatter(API_VERSION, General.INTERNAL_ERROR_STATUS_CODE, e.Message)
                             .Fail();
                return(StatusCode(General.INTERNAL_ERROR_STATUS_CODE, result));
            }
        }
        public IActionResult DeleteConfirmed(int id)
        {
            log.Info(nameof(DeleteConfirmed) + ": Post");

            try
            {
                transportService.Delete(id);
            }
            catch (Exception e)
            {
                log.Error(e);

                return(BadRequest());
            }

            return(RedirectToAction(nameof(Index)));
        }