public IActionResult Delete(int id)
        {
            var result = _service.Delete(id);

            switch (result.ResultMessage)
            {
            case Enums.ResponseMessage.OK:
                return(StatusCode(StatusCodes.Status200OK, result.Result));

            case Enums.ResponseMessage.ERROR:
                return(StatusCode(StatusCodes.Status500InternalServerError, result.Exception));

            case Enums.ResponseMessage.NOTFOUND:
                return(StatusCode(StatusCodes.Status404NotFound));

            case Enums.ResponseMessage.UNAUTHORIZED:
                return(StatusCode(StatusCodes.Status401Unauthorized));

            case Enums.ResponseMessage.WARNING:
                return(StatusCode(StatusCodes.Status500InternalServerError, result.Message));

            default:
                return(StatusCode(StatusCodes.Status404NotFound));
            }
        }
Esempio n. 2
0
        public IActionResult Delete(StokCikis stokCikis)
        {
            var result = _stokCikisService.Delete(stokCikis);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }