public async Task <ActionResult> GetUserThemeList(string user, int index, int rows, string search) { Domain.Clients.Client client = Domain.Clients.Hub.GetClientByAccount(user); Domain.Resp resp = await client.GetSelfThemes(index, rows, search); return(Pack(resp)); }
private bool CheckAccount(List <Claim> claimsList) { string token = claimsList.First(c => c.Type == ClaimTypes.Authentication).Value; string idStr = claimsList.First(c => c.Type == ClaimTypes.PrimarySid).Value; if (!int.TryParse(idStr, out int id)) { return(false); } Domain.Clients.Client client = Domain.Clients.Hub.GetClient(id, token); return(!client.IsEmpty()); }
public async Task Test_Create_Client() { //arrange var provider = new TestClientProvider(); var clientToSubmit = new Domain.Clients.Client() { Name = "franco", Adress = "calle falsa 123", Email = $"{Guid.NewGuid()}@gmail", Number = "12345" }; var json = JsonConvert.SerializeObject(clientToSubmit); // act var response = await provider.Client.PostAsync("api/client/create", new StringContent(json, Encoding.UTF8, "application/json")); response.EnsureSuccessStatusCode(); //assert response.StatusCode.Should().Be(HttpStatusCode.NoContent); var request = new HttpRequestMessage(HttpMethod.Delete, "api/client/delete") { Content = new StringContent(JsonConvert.SerializeObject(clientToSubmit.Email), Encoding.UTF8, "application/json") }; await provider.Client.SendAsync(request); }