public async Task TestAddOrUpdateClientAsync() { var dictClients = await stateManager.GetOrAddAsync<IReliableDictionary2<string, Client>>(Service.DictionaryName_Client); var client = Client.Default(); var appService = new ClientAppService(statefulServiceContext, stateManager); var result = await appService.AddOrUpdateClientAsync(client); Assert.IsTrue(result); }
public ActionResult AuthorizeConfirm() { // to get here we must already be authenticated via FormsAuthentication ViewBag.DisplayName = GetDisplayName(User.Identity.Name); var clientAppService = new ClientAppService(); var clientApp = clientAppService.GetClientAppBytId(Request.QueryString["client_id"]); return(View(clientApp)); }
public ActionResult Create(ClientViewModel model) { var svc = new ClientAppService(); var toCreate = model.GetModel(); var result = svc.Create(toCreate); if (result.Id > 0) { return(RedirectToAction("Index")); } ViewBag.ErrorMessage = "Erro ao criar o Cliente"; return(View("New", model)); }
public ActionResult AuthorizeConfirm(string command) { if (command == "grant") { // The OAuthProvider will only issue a token in the Authorize action. return(RedirectToAction("Authorize", new { client_id = Request.QueryString["client_id"], redirect_uri = Request.QueryString["redirect_uri"], response_type = Request.QueryString["response_type"] })); } else if (command == "login") { FormsAuthentication.SignOut(); return(new HttpUnauthorizedResult()); } // to get here we must already be authenticated via FormsAuthentication ViewBag.DisplayName = GetDisplayName(User.Identity.Name); var clientAppService = new ClientAppService(); var clientApp = clientAppService.GetClientAppBytId(Request.QueryString["client_id"]); return(View(clientApp)); }
private static IEnumerable <ClientViewModel> GetClientViewModel() { var resultList = new List <ClientViewModel>(); var svc = new ClientAppService(); var result = svc.FindBy(null).ToList(); if (result.Count > 0) { foreach (var item in result) { resultList.Add( new ClientViewModel { Id = item.Id, CnpjCliente = item.Cnpj, NomeCliente = item.ClientName, NomeContatoCliente = item.ContactName } ); } } return(resultList); }
public ActionResult Edit(int id) { if (id <= 0) { return(RedirectToAction("Index")); } var svc = new ClientAppService(); var model = svc.Get(id); if (model == null) { return(RedirectToAction("Index")); } var vm = new ClientViewModel { CnpjCliente = model.Cnpj, Id = model.Id, NomeCliente = model.ClientName, NomeContatoCliente = model.ContactName }; return(View(vm)); }
//REALIZAR A INJEÇÃO DE DEPENDÊCIA public ClientProductController(ClientProductAppService clientProductAppService, ClientAppService clientAppService, ProductAppService productAppService) { _clientProductAppService = clientProductAppService; _clientAppService = clientAppService; _productAppService = productAppService; }
public ClientsController() { _clientAppService = new ClientAppService(); }
public ClientController(ClientAppService clientAppService) { this.clientAppService = clientAppService; }
public ConfigsController(ClientAppService clientAppService) { _clientAppService = clientAppService; }
public OAuthProvider() { clientAppService = new ClientAppService(); clientManager = DA.Use <IClientManager>(); }
public async Task Create_Update_Find_Delete_ClientTest() { #region 构造实体对象 var client = new Client { ClientId = "sso.mc", ClientName = "SSO Management Console Client (Don't Delete)", ClientSecrets = { new Secret("Microsoft".Sha256()) }, RequireConsent = false, AllowedGrantTypes = GrantTypes.Hybrid, AllowedScopes = { IdentityServerConstants.StandardScopes.OpenId, IdentityServerConstants.StandardScopes.Profile, "profile.ext" }, RedirectUris = { "http://localhost:7170/signin-oidc", "http://localhost:10102/signin-oidc", }, }; #endregion var service = new ClientAppService(this.CreateDbContext); var createResult = await service.CreateClientsAsync(new List <Client>() { client }); Assert.IsTrue(createResult > 0); client.ClientName = "Update_ClientName"; var updateResult = await service.UpdateClientsAsync(new List <Client>() { client }); Assert.IsTrue(updateResult > 0); var clientById = await service.FindClientByIdAsync(client.ClientId); Assert.IsTrue(clientById.ClientName == "Update_ClientName"); Assert.IsNotNull(clientById); var clientByName = await service.FindClientByNameAsync(client.ClientName); Assert.IsTrue(clientByName.ClientName == "Update_ClientName"); Assert.IsNotNull(clientByName); var clients = await service.GetAllClientAsync(); Assert.IsNotNull(clients); Assert.IsTrue(clients.Any()); var deleteResult = await service.DeleteClientsAsync(client.ClientId); Assert.IsTrue(deleteResult); clientById = await service.FindClientByIdAsync(client.ClientId); Assert.IsNull(clientById); }