コード例 #1
0
        public async Task <IActionResult> CreateExpert([FromBody] ExpertInfoWriteDto expertInfo)
        {
            var createExpert = new CreateExpert(expertInfo.Nickname);

            var isCompletedSuccessfully = await _mediator.Send(createExpert);

            if (isCompletedSuccessfully)
            {
                return(Ok());
            }
            else
            {
                return(new StatusCodeResult(StatusCodes.Status500InternalServerError));
            }
        }
コード例 #2
0
        public async Task <IActionResult> DeleteExpert(int id,
                                                       [FromBody] ExpertInfoWriteDto expertInfo)
        {
            var deleteExpert = new DeleteExpert(id);

            var isCompletedSuccessfully = await _mediator.Send(deleteExpert);

            if (isCompletedSuccessfully)
            {
                return(NoContent());
            }
            else
            {
                return(new StatusCodeResult(StatusCodes.Status500InternalServerError));
            }
        }
コード例 #3
0
        public async Task <IActionResult> UpdateExpert(int id,
                                                       [FromBody] ExpertInfoWriteDto expertInfo)
        {
            var updateExpert = new UpdateExpertInfo(id, expertInfo.Nickname);

            var isCompletedSuccessfully = await _mediator.Send(updateExpert);

            if (isCompletedSuccessfully)
            {
                return(new StatusCodeResult(StatusCodes.Status201Created));
            }
            else
            {
                return(new StatusCodeResult(StatusCodes.Status500InternalServerError));
            }
        }