public async Task <ActionResult> Post(string name, [FromBody] RegionCreationInfo creationInfo) { // _logger.LogInformation("Image Base64: {0}", creationInfo.ImageBase64); var region = new PostRegionEntity { Title = name }; if (!string.IsNullOrEmpty(creationInfo?.ImageBase64)) { region.IconData = Convert.FromBase64String(creationInfo.ImageBase64); } try { _dataFacade.AddPostRegion(region); await _dataFacade.CommitChanges(); } catch (DataFacadeException) { // name 字段不合法 return(BadRequest()); } catch (Exception ex) { _logger.LogError(ex, "向数据源添加板块时抛出异常:{0}:{1}", ex.GetType(), ex.Message); throw; } return(Ok()); }