public ActionResult Index() { if (Session["visited"] == null) { return(RedirectToAction("../Account/Verify")); } if (Session["PAT"] == null) { try { AccessDetails _accessDetails = new AccessDetails(); string code = Session["PAT"] == null ? Request.QueryString["code"] : Session["PAT"].ToString(); string redirectUrl = ConfigurationManager.AppSettings["RedirectUri"]; string clientId = ConfigurationManager.AppSettings["ClientSecret"]; string accessRequestBody = string.Empty; accessRequestBody = Account.GenerateRequestPostData(clientId, code, redirectUrl); _accessDetails = Account.GetAccessToken(accessRequestBody); ProfileDetails profile = Account.GetProfile(_accessDetails); if (!string.IsNullOrEmpty(_accessDetails.access_token)) { Session["PAT"] = _accessDetails.access_token; if (profile.displayName != null || profile.emailAddress != null) { Session["User"] = profile.displayName ?? string.Empty; Session["Email"] = profile.emailAddress ?? profile.displayName.ToLower(); } } } catch { } } return(View()); }
public ProfileDetails UpdateProfile(ProfileDetails newProfile) { _context.Update(newProfile); _context.SaveChanges(); return(newProfile); }
public IActionResult Profile(string id) { CommonFunction str = new CommonFunction(); string userId = AuthSession.GetUserId(HttpContext, "userId"); ProfileDetails profile = new ProfileDetails(); bool hasError = false; if (!str.CheckIsNullOrEmpty(id)) { var hasprofile = db.ProfileDetails.Where(x => x.ProfileUserId == id); if (hasprofile.Any()) { profile = hasprofile.FirstOrDefault(); } else { hasError = true; } } else { UserBasic user = db.UserBasic.Where(x => x.UserIdSystem == userId).FirstOrDefault(); profile.ProfileId = 0; profile.FirstName = user.FirstName; profile.MiddleName = user.MiddleName; profile.LastName = user.LastName; profile.Email = user.Email; } ViewBag.error = hasError; return(View(profile)); }
public ProfileDetails parse(string linkedinProfileHtml) { try { linkedinProfile = new ProfileDetails(); HtmlDocument profileHTML = new HtmlDocument(); profileHTML.LoadHtml(linkedinProfileHtml); HtmlNode[] nodes = profileHTML.DocumentNode.SelectNodes("//div").ToArray(); foreach (HtmlNode item in nodes) { // Name if (item.Id == "name") { linkedinProfile.name = item.InnerText.ToString(); } // Title if (item.Id == "headline") { linkedinProfile.currentTitle = item.InnerText.ToString(); } // Summery if (item.Id == "summary-item-view") { linkedinProfile.Summary = item.FirstChild.FirstChild.InnerText.ToString(); } // Experience if (item.Id == "background-experience") { experienceParse(item); } // Education if (item.Id == "background-education") { educationParse(item); } } // Skills nodes = profileHTML.DocumentNode.SelectNodes("//li").ToArray(); if (nodes != null) { skillsParse(nodes); } // Current posstion nodes = profileHTML.DocumentNode.SelectNodes("//tr").ToArray(); if (nodes != null) { currentPosstionParse(nodes); } return(linkedinProfile); } catch (Exception ex) { throw ex; } }
private long CreateCollection(string filename, Stream fileContent, ProfileDetails profileDetails, CommunityDetails parentCommunity) { // Get name/ tags/ category from Tour. var collectionDoc = new XmlDocument(); ContentDetails content = null; // NetworkStream is not Seek able. Need to load into memory stream so that it can be sought using (Stream writablefileContent = new MemoryStream()) { fileContent.CopyTo(writablefileContent); writablefileContent.Position = 0; content = GetContentDetail(filename, writablefileContent, profileDetails, parentCommunity); writablefileContent.Seek(0, SeekOrigin.Begin); collectionDoc = collectionDoc.SetXmlFromWtml(writablefileContent); } if (collectionDoc != null) { content.Name = collectionDoc.GetAttributeValue("Folder", "Name"); } var contentService = DependencyResolver.Current.GetService(typeof(IContentService)) as IContentService; var contentId = content.ID = contentService.CreateContent(content); if (contentId > 0) { var notificationService = DependencyResolver.Current.GetService(typeof(INotificationService)) as INotificationService; notificationService.NotifyNewEntityRequest(content, BaseUri() + "/"); } return(contentId); }
private static List <Vector3> ExtrudeAdvanced(this ProfileDetails path, ObjectPart.PrimitiveShape.Decoded shape, double twistBegin, double twistEnd, double cut) { var extrusionPath = new List <Vector3>(); double twist; double angle = 0.0.Lerp(shape.Revolutions * 2 * Math.PI, cut); var taper = new Vector3(); double radiusOffset; twist = twistBegin.Lerp(twistEnd, cut); #region taper taper.X = shape.Taper.X < 0f ? 1.0.Lerp(1 + shape.Taper.X, 1f - cut) : 1.0.Lerp(1 - shape.Taper.X, cut); taper.Y = shape.Taper.Y < 0f ? 1.0.Lerp(1 + shape.Taper.Y, 1f - cut) : 1.0.Lerp(1 - shape.Taper.Y, cut); #endregion #region radius offset radiusOffset = shape.RadiusOffset > 0f ? 1.0.Lerp(1 - shape.RadiusOffset, 1f - cut) : 1.0.Lerp(1 + shape.RadiusOffset, cut); #endregion /* generate extrusions */ foreach (var vertex in path.Vertices) { extrusionPath.Add(shape.CalcAdvVertex(vertex, angle, twist, cut, taper, radiusOffset)); } return(extrusionPath); }
public async Task <ProfileDetails> GetUserByIdAsync(string UserId) { try { var user = _context.Users.Where(x => x.Id == UserId).FirstOrDefault(); //user = await _userManager.Users.FirstOrDefaultAsync(x => x.Id == UserId); Firstname = user.OtherNames; Surname = user.Surname; ProfileDetails details = new ProfileDetails { Id = user.Id, Surname = user.Surname, OtherName = user.OtherNames, Society = user.Organisation, ProfileImage = GetImagePath(user.ImagePath), DisplayName = GetDisplayName(Surname, Firstname), Occupation = user.Occupation, Parish = user.WorshipCenter }; //ProfileDetails details = new User(); return(details); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult> Profile() { var userId = User.FindFirst(ClaimTypes.NameIdentifier).Value; ProfileDetails details = await _profileManager.GetUserByIdAsync(userId); return(View(details)); }
public List <ProfileDetails> GetProfilesEndPoint(SaiMatrimonyDb db, string edu, string pro, string mname, string location, string category, string fromid) { List <ProfileDetails> allProfiles = (from p in db.ProfileDetails where p.IsProfileApproved select p ).ToList(); var hasFromApprovedProfile = allProfiles.Where(x => x.ProfileUserId == fromid); if (!hasFromApprovedProfile.Any()) { return(new List <ProfileDetails>()); } ProfileDetails fromProfile = hasFromApprovedProfile.FirstOrDefault(); allProfiles = allProfiles.Where(x => x.Gender.ToLower() != fromProfile.Gender.ToLower()).ToList(); List <ProfileReview> matches = db.ProfileReview.ToList(); List <string> imatches = (from m in matches where m.ProposedFromUserId == fromid select m.ProposedToUserId).ToList(); List <string> omatches = (from m in matches where m.ProposedToUserId == fromid select m.ProposedFromUserId).ToList(); return(GetProfilesLogic(allProfiles, imatches, omatches, edu, pro, mname, location, category)); }
public IActionResult MatchDetail(int reviewid, string fromid) { ProfileReview profile = new ProfileReview(); ProfileDetails pdetail = new ProfileDetails(); List <ProfileComment> comments = new List <ProfileComment>(); bool iProposed = false; string profileId = ""; var hasMatch = db.ProfileReview.Where(x => x.ProfileReviewId == reviewid); if (hasMatch.Any()) { profile = hasMatch.FirstOrDefault(); profileId = profile.ProposedFromUserId == fromid ? profile.ProposedToUserId : profile.ProposedFromUserId; iProposed = profile.ProposedFromUserId == fromid ? true : false; pdetail = db.ProfileDetails.Where(x => x.ProfileUserId == profileId).FirstOrDefault(); comments = db.ProfileComment.Where(x => x.ProfileReviewId == reviewid).OrderByDescending(x => x.CommentDate).ToList(); } ViewBag.profile = profile; ViewBag.iProposed = iProposed; ViewBag.comments = comments; ViewBag.fromid = fromid; ViewBag.toid = profileId; return(View(pdetail)); }
public long CreateProfile(ProfileDetails profileDetails) { // Make sure communityDetails is not null this.CheckNotNull(() => new { profileDetails }); // Check if the user already exists in the Layerscape database. User existingUser = _userRepository.GetItem(u => u.LiveID == profileDetails.PUID); if (existingUser != null) { return(existingUser.UserID); } else { // 1. Add Community details to the community object. var user = new User(); Mapper.Map(profileDetails, user); user.JoinedDateTime = DateTime.UtcNow; user.LastLoginDatetime = DateTime.UtcNow; // While creating the user, IsDeleted to be false always. user.IsDeleted = false; // Add the user to the repository _userRepository.Add(user); // Save all the changes made. _userRepository.SaveChanges(); return(user.UserID); } }
internal void UpdateCel(ProfileDetails Saved_profile) { this.Layer.BorderColor = UIColor.FromRGB(75, 171, 229).CGColor; this.Layer.BorderWidth = 3f; this.Layer.CornerRadius = 20f; this.profile_image.Frame = new CoreGraphics.CGRect(0, 0, this.Frame.Width, this.Frame.Height); profile_name.BackgroundColor = UIColor.FromRGB(246, 194, 96); try { if (!string.IsNullOrEmpty(Saved_profile.image_url)) { profile_image.Image = FromUrl(Saved_profile.image_url); profile_image.ContentMode = UIViewContentMode.ScaleToFill; } else { profile_image.Image = FromUrl("https://srendip-dev.s3.amazonaws.com/no-image-icon.png"); } } catch (Exception ex) { } profile_name.AttributedText = new NSAttributedString(Saved_profile.first_name + "," + Saved_profile.age, underlineStyle: NSUnderlineStyle.None); profile_name.TextAlignment = UITextAlignment.Center; }
/// <summary> /// Notify the user about the new User. /// </summary> /// <param name="profileDetails">User details</param> /// <param name="server">Server details.</param> public void NotifyNewEntityRequest(ProfileDetails profileDetails, string server) { if (Constants.CanSendNewEntityMail) { SendNewUserMail(profileDetails, server); } }
public ProfileDetails GetUserDetails(long id) { User user = _repository.Get(id); ProfileDetails profileDetails = _mapper.Map <User, ProfileDetails>(user); return(profileDetails); }
public ProfileDetails GetProfile(AccessDetails accessDetails) { ProfileDetails profile = new ProfileDetails(); using (var client = new HttpClient()) { try { string baseAddress = System.Configuration.ConfigurationManager.AppSettings["BaseAddress"]; client.BaseAddress = new Uri(baseAddress); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessDetails.access_token); HttpResponseMessage response = client.GetAsync("_apis/profile/profiles/me?api-version=4.1").Result; if (response.IsSuccessStatusCode && response.StatusCode == HttpStatusCode.OK) { string result = response.Content.ReadAsStringAsync().Result; profile = JsonConvert.DeserializeObject <ProfileDetails>(result); return(profile); } else { var errorMessage = response.Content.ReadAsStringAsync(); } } catch (Exception) { } return(profile); } }
private long CreateTour(string filename, Stream fileContent, ProfileDetails profileDetails, CommunityDetails parentCommunity) { var tourDoc = new XmlDocument(); ContentDetails content = null; // NetworkStream is not Seek able. Need to load into memory stream so that it can be sought using (Stream writablefileContent = new MemoryStream()) { fileContent.CopyTo(writablefileContent); writablefileContent.Position = 0; content = GetContentDetail(filename, writablefileContent, profileDetails, parentCommunity); writablefileContent.Position = 0; tourDoc = tourDoc.SetXmlFromTour(writablefileContent); } if (tourDoc != null) { // Note that the spelling of Description is wrong because that's how WWT generates the WTT file. content.Name = tourDoc.GetAttributeValue("Tour", "Title"); content.Description = tourDoc.GetAttributeValue("Tour", "Descirption"); content.DistributedBy = tourDoc.GetAttributeValue("Tour", "Author"); content.TourLength = tourDoc.GetAttributeValue("Tour", "RunTime"); } var contentService = DependencyResolver.Current.GetService(typeof(IContentService)) as IContentService; var contentId = content.ID = contentService.CreateContent(content); if (contentId > 0) { var notificationService = DependencyResolver.Current.GetService(typeof(INotificationService)) as INotificationService; notificationService.NotifyNewEntityRequest(content, BaseUri() + "/"); } return(contentId); }
private async Task <ProfileDetails> InitUserProfile(string liveId, string accessToken) { if (string.IsNullOrEmpty(liveId)) { return(null); } var profileDetails = ProfileService.GetProfile(liveId); if (profileDetails == null) { if (string.IsNullOrEmpty(accessToken)) { return(null); } var svc = new LiveIdAuth(); var getResult = await svc.GetMeInfo(accessToken); var jsonResult = getResult; profileDetails = new ProfileDetails(jsonResult) { IsSubscribed = true, UserType = UserTypes.Regular }; // While creating the user, IsSubscribed to be true always. // When creating the user, by default the user type will be of regular. profileDetails.ID = ProfileService.CreateProfile(profileDetails); // This will used as the default community when user is uploading a new content. // This community will need to have the following details: var communityDetails = new CommunityDetails { CommunityType = CommunityTypes.User, // 1. This community type should be User CreatedByID = profileDetails.ID, // 2. CreatedBy will be the new USER. IsFeatured = false, // 3. This community is not featured. Name = Resources.UserCommunityName, // 4. Name should be NONE. AccessTypeID = (int)AccessType.Private, // 5. Access type should be private. CategoryID = (int)CategoryType.GeneralInterest // 6. Set the category ID of general interest. We need to set the Category ID as it is a foreign key and cannot be null. }; var communityService = DependencyResolver.Current.GetService(typeof(ICommunityService)) as ICommunityService; var notificationService = DependencyResolver.Current.GetService(typeof(INotificationService)) as INotificationService; // 7. Create the community communityService.CreateCommunity(communityDetails); // Send New user notification. notificationService.NotifyNewEntityRequest(profileDetails, HttpContext.Request.Url.GetServerLink()); } SessionWrapper.Set("CurrentUserID", profileDetails.ID); SessionWrapper.Set("CurrentUserProfileName", profileDetails.FirstName + " " + profileDetails.LastName); SessionWrapper.Set("ProfileDetails", profileDetails); return(profileDetails); }
public ActionResult Index(ProjectList.ProjectDetails model) { try { AccessDetails accessDetails = new AccessDetails(); string pat = ""; string email = ""; if (Session["PAT"] != null) { pat = Session["PAT"].ToString(); } if (Session["Email"] != null) { email = Session["PAT"].ToString(); } if (string.IsNullOrEmpty(pat)) { return(Redirect("../Account/Verify")); } else { accessDetails.access_token = pat; ProfileDetails profile = accountService.GetProfile(accessDetails); if (profile == null) { ViewBag.ErrorMessage = "Could not fetch your profile details, please try to login again"; return(View(model)); } if (profile.displayName != null && profile.emailAddress != null) { Session["User"] = profile.displayName; Session["Email"] = profile.emailAddress.ToLower(); } AccountsResponse.AccountList accountList = accountService.GetAccounts(profile.id, accessDetails); model.accessToken = accessDetails.access_token; model.accountsForDropdown = new List <string>(); if (accountList.count > 0) { foreach (var account in accountList.value) { model.accountsForDropdown.Add(account.accountName); } model.accountsForDropdown.Sort(); } else { model.accountsForDropdown.Add("Select Organization"); ViewBag.AccDDError = "Could not load your organizations. Please change the directory in profile page of Azure DevOps Organization and try again."; } return(View(model)); } } catch (Exception ex) { ExtractorService.logger.Info(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "\t" + ex.Message + "\n" + ex.StackTrace + "\n"); } return(View(model)); }
/// <summary> /// Set the profile details like User ID, profile name and a Boolean indicating whether the user is site admin or not /// in to the session variables. /// </summary> /// <param name="profileDetails">Profile details object.</param> public static void SetProfileSessionValues(this ProfileDetails profileDetails) { if (profileDetails != null) { SessionWrapper.Set <long>("CurrentUserID", profileDetails.ID); SessionWrapper.Set <bool>("IsSiteAdmin", profileDetails.UserType == UserTypes.SiteAdmin ? true : false); SessionWrapper.Set <string>("CurrentUserProfileName", profileDetails.GetProfileName()); } }
protected async Task <LiveLoginResult> TryAuthenticateFromHttpContext(ICommunityService communityService, INotificationService notificationService) { var svc = new LiveIdAuth(); var result = await svc.Authenticate(); if (result.Status == LiveConnectSessionStatus.Connected) { var client = new LiveConnectClient(result.Session); SessionWrapper.Set("LiveConnectClient", client); SessionWrapper.Set("LiveConnectResult", result); SessionWrapper.Set("LiveAuthSvc", svc); var getResult = await client.GetAsync("me"); var jsonResult = getResult.Result as dynamic; var profileDetails = ProfileService.GetProfile(jsonResult.id); if (profileDetails == null) { profileDetails = new ProfileDetails(jsonResult); // While creating the user, IsSubscribed to be true always. profileDetails.IsSubscribed = true; // When creating the user, by default the user type will be of regular. profileDetails.UserType = UserTypes.Regular; profileDetails.ID = ProfileService.CreateProfile(profileDetails); // This will used as the default community when user is uploading a new content. // This community will need to have the following details: var communityDetails = new CommunityDetails { CommunityType = CommunityTypes.User, // 1. This community type should be User CreatedByID = profileDetails.ID, // 2. CreatedBy will be the new USER. IsFeatured = false, // 3. This community is not featured. Name = Resources.UserCommunityName, // 4. Name should be NONE. AccessTypeID = (int)AccessType.Private, // 5. Access type should be private. CategoryID = (int)CategoryType.GeneralInterest // 6. Set the category ID of general interest. We need to set the Category ID as it is a foreign key and cannot be null. }; // 7. Create the community communityService.CreateCommunity(communityDetails); // Send New user notification. notificationService.NotifyNewEntityRequest(profileDetails, HttpContext.Request.Url.GetServerLink()); } SessionWrapper.Set <long>("CurrentUserID", profileDetails.ID); SessionWrapper.Set <string>("CurrentUserProfileName", profileDetails.FirstName + " " + profileDetails.LastName); SessionWrapper.Set("ProfileDetails", profileDetails); SessionWrapper.Set("AuthenticationToken", result.Session.AuthenticationToken); } return(result); }
public ActionResult Edit([Bind(Exclude = "profileImage")] ProfileDetails profileDetails, bool useOldImage = false) { int userId = AuthorizeLoggedInUser(); byte[] imageData = null; if (useOldImage == false) { // Convert the user upload to byte array if (Request.Files.Count > 0) { HttpPostedFileBase poImageFile = Request.Files["profileImageUpdate"]; using (var binary = new BinaryReader(poImageFile.InputStream)) { imageData = binary.ReadBytes(poImageFile.ContentLength); } } } // Retrieving old profile details to get old image ProfileDetails oldProfile = db.ProfileDetails.Find(userId); if (ModelState.IsValid) { var newInfo = db.ProfileDetails.Find(AuthorizeLoggedInUser()); newInfo.firstName = profileDetails.firstName; newInfo.lastName = profileDetails.lastName; newInfo.prefferedName = profileDetails.prefferedName; newInfo.phoneNumber = profileDetails.phoneNumber; newInfo.hireDate = profileDetails.hireDate; newInfo.businessUnit = profileDetails.businessUnit; newInfo.position = profileDetails.position; if (useOldImage == true) { newInfo.profileImage = oldProfile.profileImage; } else { // Double checking user input. if (imageData != null) { newInfo.profileImage = imageData; } else { // If we get here, the user unchecked the box, but // did not upload new image. We will default to old image newInfo.profileImage = oldProfile.profileImage; } } db.SaveChanges(); return(RedirectToAction("Details", new { id = profileDetails.id })); } return(View(profileDetails)); }
public IHttpActionResult Get(string code, string state) { try { //Get Accedd Token string tokenURL = ConfigurationManager.AppSettings["linkedinTokenURL"].ToString().Trim(); string redirectURL = ConfigurationManager.AppSettings["redirect_uri"].ToString().Trim(); string clientID = ConfigurationManager.AppSettings["client_id"].ToString().Trim(); string clientSecret = ConfigurationManager.AppSettings["client_secret"].ToString().Trim(); string linkedInURL = ConfigurationManager.AppSettings["linkedinTokenProfileURL"].Trim(); // var client = new RestClient(tokenURL); ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; var request = new RestRequest(Method.POST); request.AddParameter("grant_type", "authorization_code"); request.AddParameter("code", code); request.AddParameter("redirect_uri", redirectURL); request.AddParameter("client_id", clientID); //77y6szcym3yi3y request.AddParameter("client_secret", clientSecret); //8vu2T0u2g8hQhYBd //request.AddParameter("client_id", "78tuxrz2ilh6cu");//77y6szcym3yi3y //request.AddParameter("client_secret", "chiIQpga33iaLZgp");//8vu2T0u2g8hQhYBd IRestResponse response = client.Execute(request); if (response.StatusCode != HttpStatusCode.BadRequest) { var content = response.Content; //Fetch AccessToken JavaScriptSerializer jsonSerializer = new JavaScriptSerializer(); LinkedInTokenDetails linkedINVM = jsonSerializer.Deserialize <LinkedInTokenDetails>(content); //Get Profile Details // client = new RestClient("https://api.linkedin.com/v1/people/~?oauth2_access_token=" + linkedINVM.access_token + "&format=json"); client = new RestClient(linkedInURL + linkedINVM.access_token + "&format=json"); request = new RestRequest(Method.GET); response = client.Execute(request); content = response.Content; jsonSerializer = new JavaScriptSerializer(); ProfileDetails linkedINResVM = jsonSerializer.Deserialize <ProfileDetails>(content); return(Ok(linkedINResVM)); } else { return(Ok("No Response")); } } catch { throw; } }
public static void CacheProfile(string accessToken, ProfileDetails profileDetails) { HttpRuntime.Cache.Add( accessToken, profileDetails, null, DateTime.Now.AddHours(1), Cache.NoSlidingExpiration, CacheItemPriority.Default, null); }
public void Apply(ParticipantCreated e) { Name = e.Name; Gender = e.Gender; IsDelegate = e.IsDelegate; IsGuest = e.IsGuest; YearsQualifying = e.YearsQualifying; Birthday = e.Birthday; Package = new PackageInformation(); Profile = new ProfileDetails(); }
protected static bool ValidateAuthentication(bool throwWebFaultException, out ProfileDetails profileDetails) { LiveLoginResult result = SessionWrapper.Get <LiveLoginResult>("LiveConnectResult"); if (result != null && result.Status == LiveConnectSessionStatus.Connected) { profileDetails = SessionWrapper.Get <ProfileDetails>("ProfileDetails"); return(true); } profileDetails = new ProfileDetails(); return(false); }
public static ProfileDetails GetProfileDetails(string accessToken) { try { ProfileDetails profileDetails = (ProfileDetails)HttpRuntime.Cache[accessToken]; return(profileDetails); } catch (Exception) { return(null); } }
/// <summary> /// Gets the profile name from the profile details object. Concatenates the first name and last name and returns the profile name. /// </summary> /// <param name="profileDetails">Profile details object.</param> /// <returns>Profile name</returns> public static string GetProfileName(this ProfileDetails profileDetails) { string profileName = string.Empty; if (profileDetails != null) { profileName = string.Join(" ", new string[] { profileDetails.FirstName, profileDetails.LastName }); profileName = profileName.Trim(); } return(profileName); }
public ProfileDetails postgetProfileDetails(string Email) { ProfileDetails response_model = null; StringContent content; try { var RestURL = BaseURL + "get_profile"; HttpClient client = new HttpClient(); client.BaseAddress = new Uri(RestURL); JObject j = new JObject(); j.Add("email", Email); var json = JsonConvert.SerializeObject(j); content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PostAsync(RestURL, content).Result; // Blocking call! if (response.IsSuccessStatusCode) { response_model = new ProfileDetails(); // Parse the response body. Blocking! var dataObjects = response.Content.ReadAsStringAsync().Result; JObject jObj = JObject.Parse(dataObjects); response_model.EMPLOYER_ID = jObj["data"]["employer_id"].ToString(); response_model.COMPANY_NAME = jObj["data"]["company_name"].ToString(); response_model.CONTACT_PERSON = jObj["data"]["contact_person"].ToString(); response_model.EMAIL = jObj["data"]["email"].ToString(); response_model.PHONE = jObj["data"]["phone"].ToString(); response_model.CURRENT_REQUIRMENT = jObj["data"]["current_requirment"].ToString(); response_model.EXPERIENCE = jObj["data"]["experience"].ToString(); response_model.SKILL = jObj["data"]["skill"].ToString(); response_model.JOB_ROLE = jObj["data"]["job_role"].ToString(); response_model.LOCATION = jObj["data"]["location"].ToString(); response_model.ADDRESS = jObj["data"]["address"].ToString(); response_model.EXP_DATE = jObj["data"]["exp_date"].ToString(); response_model.PACKAGE = jObj["data"]["package"].ToString(); response_model.AMOUNT = jObj["data"]["amount "].ToString(); response_model.USER_TYPE = jObj["data"]["user_type"].ToString(); } } catch (Exception e) { StaticMethods.AndroidSnackBar(e.Message); } finally { content = null; } return(response_model); }
public ActionResult SaveNew(ProfileDetails profileDetails) { if (!ModelState.IsValid) { return(View("New")); } _context.ProfileDetails.Add(profileDetails); _context.SaveChanges(); return(RedirectToAction("Index", "ProfileDetails")); }
// GET: WIReport public ActionResult Index() { if (Session["visited"] == null) { return(RedirectToAction("../Account/Verify")); } if (Session["PAT"] == null) { InputModel input = new InputModel(); try { AccessDetails _accessDetails = new AccessDetails(); AccountsResponse.AccountList accountList = null; string code = Session["PAT"] == null ? Request.QueryString["code"] : Session["PAT"].ToString(); string redirectUrl = ConfigurationManager.AppSettings["RedirectUri"]; string clientId = ConfigurationManager.AppSettings["ClientSecret"]; string accessRequestBody = string.Empty; accessRequestBody = Account.GenerateRequestPostData(clientId, code, redirectUrl); _accessDetails = Account.GetAccessToken(accessRequestBody); ProfileDetails profile = Account.GetProfile(_accessDetails); if (!string.IsNullOrEmpty(_accessDetails.access_token)) { Session["PAT"] = _accessDetails.access_token; if (profile.displayName != null || profile.emailAddress != null) { Session["User"] = profile.displayName ?? string.Empty; Session["Email"] = profile.emailAddress ?? profile.displayName.ToLower(); } } accountList = Account.GetAccounts(profile.id, _accessDetails); Session["AccountList"] = accountList; string pat = Session["PAT"].ToString(); List <SelectListItem> OrganizationList = new List <SelectListItem>(); foreach (var i in accountList.value) { OrganizationList.Add(new SelectListItem { Text = i.accountName, Value = i.accountName }); } ViewBag.OrganizationList = OrganizationList; } catch (Exception ex) { } } return(View()); }