public IActionResult GetTracking(string groupName, string gameVersion)
        {
            var group = _groupRepoz.GetByName(groupName);

            if (group == null)
            {
                return(NotFound());
            }

            var results = new List <dynamic>();

            foreach (var cmdr in _groupRepoz.GetCommandersInGroup(group))
            {
                var location = _locationRepoz.GetMostRecent(cmdr, gameVersion);
                if (location == null)
                {
                    continue;
                }
                var session = _sessionRepoz.GetAtDateTime(cmdr, gameVersion, location.TimeStamp);
                var ship    = _shipRepoz.GetAtDateTime(cmdr, gameVersion, location.TimeStamp);
                results.Add(ToTrackingRepresentation(session, location, ship));
            }

            return(Ok(new {
                Group = groupName,
                GameVersion = gameVersion,
                Tracking = results
            }));
        }
Beispiel #2
0
        public IActionResult GetLocation(string user, string gameVersion)
        {
            var entity = _locationRepoz.GetMostRecent(user, gameVersion);

            if (entity == null)
            {
                return(NotFound());
            }
            return(Ok(ToLocationRepresentation(user, gameVersion, entity)));
        }