public GetLanguagesResponse Get(GetLanguagesRequest request) { request.Data.SetDefaultOrder("Name"); var listResponse = repository .AsQueryable<Module.Root.Models.Language>() .Select(language => new LanguageModel { Id = language.Id, Version = language.Version, CreatedBy = language.CreatedByUser, CreatedOn = language.CreatedOn, LastModifiedBy = language.ModifiedByUser, LastModifiedOn = language.ModifiedOn, Name = language.Name, Code = language.Code }) .ToDataListResponse(request); return new GetLanguagesResponse { Data = listResponse }; }
public async Task GetLanguages_Default() { // arrange var request = new GetLanguagesRequest(); // act var result = await this.languageService.GetLanguagesAsync(request); // assert Assert.IsNotNull(result); Assert.AreEqual(StatusCode.OK, result.Status); var languages = result.Languages; Assert.AreEqual(3, languages.Count); var language1 = languages[0]; Assert.AreEqual(2, language1.Id); Assert.AreEqual("Deutsche", language1.Name); var language2 = languages[1]; Assert.AreEqual(1, language2.Id); Assert.AreEqual("English", language2.Name); var language3 = languages[2]; Assert.AreEqual(3, language3.Id); Assert.AreEqual("Français", language3.Name); }
public GetLanguagesResponse Get(GetLanguagesRequest request) { request.Data.SetDefaultOrder("Name"); var listResponse = repository .AsQueryable <Module.Root.Models.Language>() .Select(language => new LanguageModel { Id = language.Id, Version = language.Version, CreatedBy = language.CreatedByUser, CreatedOn = language.CreatedOn, LastModifiedBy = language.ModifiedByUser, LastModifiedOn = language.ModifiedOn, Name = language.Name, Code = language.Code }) .ToDataListResponse(request); return(new GetLanguagesResponse { Data = listResponse }); }
private void btnListLanguages_Click(object sender, RoutedEventArgs e) { GetLanguagesRequest request = new GetLanguagesRequest(); List <Language> languages = XdServices.Invoke(request); listLanguages.ItemsSource = languages; }
public async Task<GetLanguagesResponse> GetLanguagesAsync(GetLanguagesRequest request) { var response = new GetLanguagesResponse(); try { response.Languages = await this.unitOfWork.LanguageRepository.GetAsync(q => q .Where(x => x.IsSupported) .OrderBy(x => x.LocalName) .Select(x => new LanguageDto { Id = x.Id, LanguageCode = x.LanguageCode, Name = x.LocalName, Region = x.LocalRegionName }) ); response.Status = StatusCode.OK; } catch (Exception ex) { this.exceptionHandler.HandleException(ex); response.Status = StatusCode.InternalServerError; } return response; }
public GetLanguagesResponse GetLanguages(GetLanguagesRequest request = null) { var response = new GetLanguagesResponse(); try { response.Languages = this.unitOfWork.LanguageRepository.Get(q => q .Where(x => x.Active) .OrderBy(x => x.LocalName) .Select(x => new LanguageDto { Id = x.Id, LanguageCode = x.LanguageCode, Name = x.LocalName }) ); response.Status = StatusCode.OK; } catch (Exception ex) { this.exceptionHandler.HandleException(ex); response.Status = StatusCode.InternalServerError; } return response; }
public void Setup() { AutoMapperConfig.RegisterMappings(); this.context = new MongoContextTestHelper(); this.repo = new LanguageRepository(context); this.request = new GetLanguagesRequest(); }
/// <remarks/> public void GetCompanyLanguagesAsync(GetLanguagesRequest GetLanguagesRequest, object userState) { if ((this.GetCompanyLanguagesOperationCompleted == null)) { this.GetCompanyLanguagesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetCompanyLanguagesOperationCompleted); } this.InvokeAsync("GetCompanyLanguages", new object[] { GetLanguagesRequest}, this.GetCompanyLanguagesOperationCompleted, userState); }
/// <remarks/> public void GetCompanyLanguagesAsync(GetLanguagesRequest GetLanguagesRequest) { this.GetCompanyLanguagesAsync(GetLanguagesRequest, null); }
public async Task <List <LanguageModel> > Handle(GetLanguagesRequest request, CancellationToken cancellationToken) { var languages = await _getLanguagesCommand.ExecuteAsync(); return(_mapper.Map <List <LanguageModel> >(languages)); }
public IEnumerable <Language> Execute(GetLanguagesRequest request) { return(languageRepository.GetAll()); }
/// <summary> /// Return the default language and the supported languages of your service /// </summary> /// <returns> GetLanguagesResponse object</returns> /// <param name="request"> GetLanguagesRequest object</param> /// <param name='jsonRpcCallId'> /// The json rpc call identifier. This is a string generated by the client, which can be used to correlate the response to the request. Max length is 256 characters. A JSON-RPC id must be generated on a per call invocation basis. The Rogerthat platform uses the id of the call to store the call result for a certain amount of time so that if something fails during the communication, the same call (having the same JSON-RPC id) can be resent to the Rogerthat service, allowing to fetch the result, without actually executing the call again. This avoids annoying problems such as duplicate delivery of messages. /// /// You should use a different JSON-RPC id for every call you make. /// /// In case of an intermittent failure such as a network connectivity problem, you can retry the same call using the same JSON-RPC id, without running the risk of duplicate execution of your call (e.g. duplicate message delivery). /// </param> public GetLanguagesResponse GetLanguages(GetLanguagesRequest request, string jsonRpcCallId) { GetLanguagesResponse result = new GetLanguagesResponse(); WireRequest(0, jsonRpcCallId, "system.get_languages", (writer) => { request.Write(writer, false); }, (reader) => { result.Read(reader); } ); return result; }
/// <summary> /// Return the default language and the supported languages of your service /// </summary> /// <returns> GetLanguagesResponse object</returns> /// <param name="request"> GetLanguagesRequest</param> public GetLanguagesResponse GetLanguages(GetLanguagesRequest request) { return GetLanguages(request, Guid.NewGuid().ToString()); }
public override async Task <LanguagePageModel> GetLanguages(GetLanguagesRequest getLanguagesRequest, ServerCallContext context) { var getLanguages = _mapper.Map <GetLanguagesRequest, GetLanguages>(getLanguagesRequest); return(_mapper.Map <PageModel <LanguageModel>, LanguagePageModel>(await _mediator.Send(getLanguages))); }
public IEnumerable <Language> Get(GetLanguagesRequest request) { throw new ArgumentException("TestMEssage"); return(getLanguagesCommand.Execute(request)); }