public async Task Create() { var rep = new RepresentativeVerbose { Name = "Orion Test", Portfolio = new RepresentativePortfolio { Address1 = "TEST ADDRESS", BusinessPhone = "123-123-1234", City = "TEST", State = "KY", Zip = "12345", Number = Guid.NewGuid().ToString(), Email = "*****@*****.**", FirstName = "TEST", LastName = "TEST", Name = "Orion Test", BrokerDealerId = 3, WholesalerId = 3 } }; var reps = new Compositions.Representatives.RepresentativesVerboseModule(Client); var result = await reps.CreateAsync(rep); Assert.Equal(result.StatusCode, StatusCode.OK); Assert.NotNull(result.Data); }
/// <summary> /// Creates a new Representative. /// </summary> /// <param name="representative"></param> /// <returns>Returns Result object with verbose Representative. (no collections)</returns> public async Task <IResult <RepresentativeVerbose> > CreateAsync(RepresentativeVerbose representative) { var request = new Request("Portfolio/Representatives/Verbose", Method.POST); request.AddParameter("application/json", JsonConvert.SerializeObject(representative)); return(await client.ExecuteTaskAsync <RepresentativeVerbose>(request)); }
/// <summary> /// Updates a Representative. /// </summary> /// <param name="representative"></param> /// <returns>Returns Result object with verbose Representative. (no collections)</returns> public async Task <IResult <RepresentativeVerbose> > UpdateAsync(RepresentativeVerbose representative) { var request = new Request("Portfolio/Representatives/Verbose/{id}", Method.PUT); request.AddUrlSegment("id", representative.Id.ToString()); // hopefully a temporary fix, the portfolio.id is not populated on the GET request. representative.Portfolio.Id = representative.Id; request.AddParameter("application/json", JsonConvert.SerializeObject(representative)); return(await client.ExecuteTaskAsync <RepresentativeVerbose>(request)); }