public static NodeInformation ToNodeInformation(Entities.NodeInformation dbInfo, Nodes dbNode, PoIs dbPoI) { return new NodeInformation { DisplayName = dbInfo.DisplayName, Node = ToNode(dbNode), RoomName = dbInfo.RoomName, NFCTag = dbInfo.NFCTag, QRCode = dbInfo.QRCode, PoI = dbPoI == null ? new PoI() : ToPoI(dbInfo.PoIs) }; }
public static PoI ToPoI(PoIs dbPoI) { return new PoI { Description = dbPoI.Description, Type = ToPoiType(dbPoI.PoiTypes) }; }
private static void CreateOrUpdateNodeInfo(MapsEntities entities, NodeInformation inputInfo, Data.Entities.NodeInformation nodeInformation, PoIs poi) { int? poiId = poi != null ? (int?)poi.Id : null; // Wenn es keine NodeInfo gibt, eine Neue anlegen if (nodeInformation == null) { entities.NodeInformation.Add(new Data.Entities.NodeInformation { DisplayName = inputInfo.DisplayName, RoomName = inputInfo.RoomName, QRCode = inputInfo.QRCode, NFCTag = inputInfo.NFCTag, PoiId = poiId, NodeId = inputInfo.Node.Id, CreationTime = DateTime.Now }); } // Ansonsten die bestehende NodeInfo aktualisieren else { nodeInformation.DisplayName = inputInfo.DisplayName; nodeInformation.RoomName = inputInfo.RoomName; nodeInformation.NFCTag = inputInfo.NFCTag; nodeInformation.QRCode = inputInfo.QRCode; nodeInformation.PoiId = poiId; } entities.SaveChanges(); }