public IActionResult Assign(int territoryId, int userId) { var credentials = albaCredentialService.GetCredentialsFrom(User.Identity.Name); var client = AuthorizationClient(); client.Authenticate(credentials); string date = DateTime.Now.ToString("yyyy-MM-dd"); string result = client.DownloadString( $"/ts?mod=assigned&cmd=assign&id={territoryId}&date={date}&user={userId}"); var myUser = GetUsersFor(credentials.AlbaAccountId) .FirstOrDefault(u => u.Id == userId); string userName = "******"; if (myUser != null) { userName = myUser.Name; } return(Redirect($"/Home/AssignSuccess?territoryId={territoryId}&userName={userName}")); }
Credentials GetCredentialsFrom(string userName) { return(albaCredentialService.GetCredentialsFrom(userName)); }