public async Task <IActionResult> PostAsync([FromBody] ModeResource resource) { if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrorMessages())); } var mode = mapper.Map <ModeResource, Mode>(resource); var result = await modeService.SaveAsync(mode); if (!result.IsSuccess) { return(BadRequest(result.Message)); } var modeResource = mapper.Map <Mode, ModeResource>(result.internalValue); return(Ok(modeResource)); }