Skip to content

Commit

Permalink
refactor(web): add empty value when no sake data found
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaojiuwo1993 committed Oct 24, 2023
1 parent a480ebd commit 14a926c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,23 @@ public override void Build()
{
_content.Add("SearchForRecordsResponse");
_content.Add("SearchForRecordsResult", "Success");
var temp = Newtonsoft.Json.JsonConvert.DeserializeXNode(_result.UserData.RootElement.ToString()).Root;
// add namespace to root element
temp.Name = SakeSoapEnvelope.SakeNamespace + temp.Name.LocalName;
// Add the namespace to each selected node
foreach (var element in temp.DescendantsAndSelf())
if (_result.UserData is not null)
{
element.Name = SakeSoapEnvelope.SakeNamespace + element.Name.LocalName;
var temp = Newtonsoft.Json.JsonConvert.DeserializeXNode(_result.UserData.RootElement.ToString()).Root;
// add namespace to root element
temp.Name = SakeSoapEnvelope.SakeNamespace + temp.Name.LocalName;
// Add the namespace to each selected node
foreach (var element in temp.DescendantsAndSelf())
{
element.Name = SakeSoapEnvelope.SakeNamespace + element.Name.LocalName;
}
_content.Add("values", temp);
}
_content.Add("values", temp);
else
{
_content.Add("values");
}

base.Build();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ protected override void DataOperation()
&& t.Tableid == _request.TableId)
.Select(s => s.Userdata).FirstOrDefault();
}
if (_result.UserData is null)
{
throw new WebServer.Exception("There are no sake data found in the database, please manually add it in the database");
}
// if (_result.UserData is null)
// {
// throw new WebServer.Exception("There are no sake data found in the database, please manually add it in the database");
// }
}
protected override void ResponseConstruct()
{
Expand Down

0 comments on commit 14a926c

Please sign in to comment.