public async Task <JsonResult> AngularQuery(Language lang, string env) { var environment = new GetEnvironment(env, true); var mongoRepository = new MongoRepository <Translation> (new BaseDbBuilder()); var predicate = PredicateBuilder.True <Translation> (); if (_Branch.HasBranch) { predicate = predicate.And(x => x.Branch == _Branch.Value); } predicate = predicate.And(x => x.Environment == environment.Value); var result = mongoRepository.Query(predicate); // Log.Debug($"AngularQuery: returning '{result.Count()}' entries for language'{lang}' on environment '{environment.Value}'"); // var resultDictionary = result.ToDictionary(t => t.Key, t => t.GetByLanguage(lang)); Log.Debug($"AngularQuery: returning '{result.Count()}' entries for language'{lang}' on environment '{environment.Value}'"); // TODO: maybe this should be changed, at least for the desktop, we skip "Desktop.", but maybe we should skip "Desktop.App." on the // new desktop, and i dont know, what we should do on the web. // HENCE, maybe create a function for this, and may enable skip on 'dot' via appsettings. var resultDictionary = result.ToDictionary(t => string.Join(".", t.Key.Split(".").Skip(1)), t => t.GetByLanguage(lang)); var jsonResult = JsonHelper.Unflatten(resultDictionary); return(new JsonResult(jsonResult)); }
/// <summary> /// Get the environment's status. /// </summary> /// <param name="request">The request.</param> public object Get(GetEnvironment request) { var status = GameController.GetEnvironmentStatus(); return (new GetEnvironmentResponse { Status = status.Item1, Players = status.Item2, Dragons = status.Item3 }); }
/// <summary> /// Get the environment's status. /// </summary> /// <param name="request">The request.</param> public object Get(GetEnvironment request) { var status = GameController.GetEnvironmentStatus(); return new GetEnvironmentResponse { Status = status.Item1, Players = status.Item2, Dragons = status.Item3 }; }
public void GetEnvironment_NotFound() { var perfTest = new GetEnvironment { Variable = Guid.NewGuid().ToString() }; Assert.Null(perfTest.GetDesktop()); Assert.Null(perfTest.GetDesktopNoCache()); Assert.Null(perfTest.GetCore()); Assert.Null(perfTest.GetCoreFixed()); Assert.Null(perfTest.GetCoreFixedInline()); Assert.Null(perfTest.GetRaw()); Assert.Null(perfTest.GetRawInline()); }
public void GetEnvironment(string value) { string expected = Environment.GetEnvironmentVariable(value); var perfTest = new GetEnvironment { Variable = value }; Assert.Equal(expected, perfTest.GetDesktop()); Assert.Equal(expected, perfTest.GetDesktopNoCache()); Assert.Equal(expected, perfTest.GetCore()); Assert.Equal(expected, perfTest.GetCoreFixed()); Assert.Equal(expected, perfTest.GetCoreFixedInline()); Assert.Equal(expected, perfTest.GetRaw()); Assert.Equal(expected, perfTest.GetRawInline()); }