protected override void InitFromBundle(IMvxBundle parameters)
 {
     string value;
     if (parameters.Data != null && parameters.Data.TryGetValue("StationId", out value))
     {
         _followStation = _followService.GetFollowStation(value);
     }
 }
        public ICollection<FollowStation> GetFollowsStations()
        {
            //Match Station.Lines and User.Follows.Lines

            var followStations = new List<FollowStation>();

            foreach (var followGroup in _follows.GroupBy(x => x.Station))
            {
                var fs = new FollowStation()
                {
                    Station = followGroup.Key,
                    Lines = new List<FollowLine>()
                };

                foreach (var line in followGroup.Key.Lines)
                {
                    fs.Lines.Add(new FollowLine()
                    {
                        Line = line,
                        IsFollowed = followGroup.Any(x => x.LineId == line.Id)
                    });
                }

                followStations.Add(fs);
            }

            return followStations;
        }
        public FollowStation GetFollowStation(string stationId)
        {
            var fs = new FollowStation()
            {
                Station = _localDbService.GetStation(stationId),
                Lines = new List<FollowLine>()
            };

            foreach (var line in fs.Station.Lines)
            {
                //if the station is no setting, default value is true for following;
                bool defaultValue = !_follows.Any(x => x.StationId == stationId);

                fs.Lines.Add(new FollowLine()
                {
                    Line = line,
                    IsFollowed = defaultValue || _follows.Any(x => x.StationId == stationId && x.LineId == line.Id)
                });
            }

            return fs;
        }