コード例 #1
0
        public IActionResult Add(StokCikis stokCikis)
        {
            var result = _stokCikisService.Add(stokCikis);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
コード例 #2
0
        public IActionResult Post([FromBody] ChepStokCikisDTO obj)
        {
            var result = _service.Add(obj);

            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));

            default:
                return(StatusCode(StatusCodes.Status404NotFound));
            }
        }