mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-14 13:07:18 +00:00
refactor: devlist request handler, added static method for creating list
This commit is contained in:
parent
faaa2a354e
commit
4dc6d5b5ac
2 changed files with 26 additions and 23 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Web
|
||||
{
|
||||
|
|
@ -14,23 +15,34 @@ namespace PepperDash.Essentials.Core.Web
|
|||
};
|
||||
}
|
||||
|
||||
public static object MapToDeviceListObject(IKeyed device)
|
||||
{
|
||||
return new
|
||||
{
|
||||
Key = device.Key,
|
||||
Name = (device is IKeyName)
|
||||
? (device as IKeyName).Name
|
||||
: "---"
|
||||
};
|
||||
}
|
||||
|
||||
public static object MapJoinToObject(string key, JoinMapBaseAdvanced join)
|
||||
{
|
||||
var kp = new KeyValuePair<string, JoinMapBaseAdvanced>(key, join);
|
||||
|
||||
return MapJoinToObject(kp);
|
||||
}
|
||||
|
||||
|
||||
public static object MapJoinToObject(KeyValuePair<string, JoinMapBaseAdvanced> join)
|
||||
{
|
||||
return new
|
||||
{
|
||||
DeviceKey = join.Key,
|
||||
Joins = join.Value.Joins.Select(j => MapJoinDatacompleteToObject(j))
|
||||
Joins = join.Value.Joins.Select(j => MapJoinDataCompleteToObject(j))
|
||||
};
|
||||
}
|
||||
|
||||
public static object MapJoinDatacompleteToObject(KeyValuePair<string, JoinDataComplete> joinData)
|
||||
public static object MapJoinDataCompleteToObject(KeyValuePair<string, JoinDataComplete> joinData)
|
||||
{
|
||||
return new
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue