private async void Button_Clicked(object sender, EventArgs e) { branchesList.BranchesList.Clear(); BranchesService bs = new BranchesService(); branchSource = await bs.GetBranches(); foreach (Branches branch in branchSource) { BranchesViewModel bvm = new BranchesViewModel { id = branch.id, branchname = branch.branchname, description = branch.description, creator_id = branch.creator_id, created_date = branch.created_date }; branchesList.BranchesList.Add(bvm); } }
/// <summary> /// Sets up HTTP methods mappings. /// </summary> /// <param name="service">Service handling requests</param> public BranchesModule(BranchesService service) : base("/") { Get["/api/program/{programId}/repository/{repositoryId}/branches"] = parameters => { var programId = Parameters.ValueOf <string>(parameters, Context.Request, "programId", ParameterType.Path); var repositoryId = Parameters.ValueOf <string>(parameters, Context.Request, "repositoryId", ParameterType.Path); var xGwImsOrgId = Parameters.ValueOf <string>(parameters, Context.Request, "xGwImsOrgId", ParameterType.Header); var authorization = Parameters.ValueOf <string>(parameters, Context.Request, "authorization", ParameterType.Header); var xApiKey = Parameters.ValueOf <string>(parameters, Context.Request, "xApiKey", ParameterType.Header); Preconditions.IsNotNull(programId, "Required parameter: 'programId' is missing at 'GetBranches'"); Preconditions.IsNotNull(repositoryId, "Required parameter: 'repositoryId' is missing at 'GetBranches'"); Preconditions.IsNotNull(xGwImsOrgId, "Required parameter: 'xGwImsOrgId' is missing at 'GetBranches'"); Preconditions.IsNotNull(authorization, "Required parameter: 'authorization' is missing at 'GetBranches'"); Preconditions.IsNotNull(xApiKey, "Required parameter: 'xApiKey' is missing at 'GetBranches'"); return(service.GetBranches(Context, programId, repositoryId, xGwImsOrgId, authorization, xApiKey)); }; }