public async Task <IActionResult> Get(int id) { var result = await _materials.GetByIdAsync(id); if (!result.Success) { if (result.Messages.ContainsKey("Material not found")) { return(NotFound(result)); } return(BadRequest(new ErrorResource(result.Messages))); } var userResource = _mapper.Map <Material, MaterialResource>(result.Resource); return(Ok(userResource)); }