public IndexModel() { ProfileLinks = new ProfileLink[] { new ProfileLink { Title = "GitHub", URL = "https://github.com/neville-nazerane", IconName = "profile-icons/2b48b22fcc8b4e90bd47e01d5cba51a3.png" }, new ProfileLink { Title = "Stackoverflow", URL = "https://stackoverflow.com/users/991609", IconName = "profile-icons/b80b9d9dc1854e1e9963760715aada39.png" }, new ProfileLink { Title = "LinkedIn", URL = "https://www.linkedin.com/in/neville-nazerane", IconName = "profile-icons/98f7973facc44a7d9cf3245e6918350d.png" }, new ProfileLink { Title = "Nuget", URL = "https://www.nuget.org/profiles/Neville.Nazerane", IconName = "profile-icons/da70f5f6070241b3bb36d03c2076982a.png" }, new ProfileLink { Title = "Stackoverflow CV", URL = "https://stackoverflow.com/story/nevillenazerane", IconName = "profile-icons/e476b6c53a114127befee3673d4b8485.png" } }; Projects = new Project[] { new Project { Title = "Nuget Documentation", Description = "Documentation for recent nuget packages.", Link = "https://docs.nevillenazerane.com", SourceCode = "https://github.com/neville-nazerane/docs" }, new Project { Title = "AutoSite", Description = "AI based app that reads, interprets and predicts data types and field names from an images. The output can then be used to generate a full stack website with database and UI.", Link = null, SourceCode = "https://github.com/neville-nazerane/autosite" }, new Project { Title = "Profile", Description = "The current website", Link = null, SourceCode = "https://github.com/neville-nazerane/profile" } }; }
public void Dispose() { _selectedClient = null; _clientList = null; _userList = null; _profileList = null; }
public async Task <IActionResult> Edit(int id, [Bind("Id,ApplicationUserId,ProfileType,ProfileUrl,AccessType")] ProfileLink profileLink) { if (id != profileLink.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(profileLink); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProfileLinkExists(profileLink.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(profileLink)); }
protected void ClearData() { lock (_syncObj) { _selectedClient = null; _userList = null; _userList = null; _profileList = null; } }
public async Task <IActionResult> Create([Bind("Id,ApplicationUserId,ProfileType,ProfileUrl,AccessType")] ProfileLink profileLink) { if (ModelState.IsValid) { _context.Add(profileLink); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = _userManager.GetUserId(User); return(View(profileLink)); }
private void SetClient(ProfileLink client) { try { _selectedClient = client; IsClientSelected = client != null; SelectedClientName = client?.ClientName ?? ""; SelectedUserInfo = _userList.FirstOrDefault(p => ((UserProfile)p.AdditionalProperties[Consts.KEY_USER]).ProfileId.ToString() == client?.DefaultUserProfile)?.Labels[Consts.KEY_NAME].Evaluate() ?? LocalizationHelper.Translate(Consts.RES_NOUSER) ?? ""; SelectedProfileInfo = _profileList.FirstOrDefault(p => p.AdditionalProperties[Consts.KEY_PROFILE].ToString() == client?.Profile)?.Labels[Consts.KEY_NAME].Evaluate() ?? client?.Profile ?? ""; } catch (Exception e) { ServiceRegistration.Get <ILogger>().Error("ClientConfigModel: Error selecting client", e); } }
private void OnClientItemSelectionChanged(AbstractProperty property, object oldValue) { // Only handle the event if new item got selected. The unselected event can be ignored. if (!(bool)property.GetValue()) { return; } ProfileLink client = null; lock (_syncObj) { client = _clientList.Where(i => i.Selected).Select(i => (ProfileLink)i.AdditionalProperties[Consts.KEY_CLIENT]).FirstOrDefault(); } SetClient(client); }
public static void SaveProfileLinks() { try { ISettingsManager settingsManager = ServiceRegistration.Get <ISettingsManager>(); ProfileLinkSettings profileLinks = settingsManager.Load <ProfileLinkSettings>(); foreach (var pair in ProfileLinks) { ProfileLink link = profileLinks.Links.FirstOrDefault(l => l.ClientName == pair.Key.ToString()); if (link == null && pair.Value != null) { link = new ProfileLink { ClientName = pair.Key.ToString(), ClientId = pair.Value.ClientId.ToString(), Profile = pair.Value.AutoProfile ? AUTO_PROFILE : pair.Value.Profile.ID }; profileLinks.Links.Add(link); } else if (link == null) { link = new ProfileLink { ClientName = pair.Key.ToString(), ClientId = pair.Value.ClientId.ToString(), Profile = AUTO_PROFILE }; profileLinks.Links.Add(link); } else if (pair.Value != null) { if (pair.Value.AutoProfile == true) { link.Profile = AUTO_PROFILE; } } } settingsManager.Save(profileLinks); } catch (Exception e) { Logger.Info("DlnaMediaServer: Exception saving profile links (Text: '{0}')", e.Message); } }
public void DeleteClient() { try { ListItem item = _clientList.FirstOrDefault(i => i.Selected); if (item == null) { return; } int oldItemIndex = _clientList.IndexOf(item) - 1; ProfileLink client = (ProfileLink)item.AdditionalProperties[Consts.KEY_CLIENT]; item.SelectedProperty.Detach(OnClientItemSelectionChanged); lock (_syncObj) _clientList.Remove(item); // Set focus to first in list if (oldItemIndex > 0 && oldItemIndex < _clientList.Count) { _clientList[oldItemIndex].Selected = true; } else { var firstItem = _clientList.FirstOrDefault(); if (firstItem != null) { firstItem.Selected = true; } } _clientList.FireChange(); } catch (NotConnectedException) { DisconnectedError(); } catch (Exception e) { ServiceRegistration.Get <ILogger>().Error("ClientConfigModel: Problems deleting client", e); } }
public void GoToProfile() { ProfileLink.Click(); }
public void Init(ProfileLink link) { GetComponentInChildren <TextMeshProUGUI>().text = link.url; GetComponentInChildren <Button>().onClick.AddListener(() => Application.OpenURL(link.url)); }
public IActionResult OnPost(IFormFile file) { //var updateUser = _context.ApplicationUser.FirstOrDefault(x => x.Id == user.Id); var updateUser = _context.ApplicationUser.FirstOrDefault(u => u.Id == _userManager.GetUserId(User)); //updateUser.FirstName = Request.Form["EditFirstName"].ToString(); //updateUser.LastName = Request.Form["EditLastName"].ToString(); //updateUser.Email = Request.Form["EditEmail"].ToString(); //updateUser.UserName = Request.Form["EditEmail"].ToString(); //updateUser.NormalizedEmail = Request.Form["EditEmail"].ToString().ToUpper(); //updateUser.NormalizedUserName = Request.Form["EditEmail"].ToString().ToUpper(); //updateUser.Description = Request.Form["EditBio"].ToString(); //_context.SaveChanges(); ////var updateLink = new ProfileLink(); DataAccessLayer.DataAccessClass dbAccess = new DataAccessLayer.DataAccessClass(); dbAccess.UpdateUser(updateUser, Request.Form["EditFirstName"].ToString(), Request.Form["EditLastName"].ToString(), Request.Form["EditEmail"].ToString(), Request.Form["EditBio"].ToString()); Links = (_context.ProfileLink.Where(x => x.InstructorId == updateUser.Id)).ToList(); //If the user has any links, creates a new profile link object //then fills that object with a link from the list //and updates the links in the database //Upload the file if (file != null) { _unitOfWork.UploadImage(file); updateUser.ImagePath = file.FileName; } _context.SaveChanges(); if (Links.Count > 0) { //Creates the profile link object. var updateLink = new ProfileLink(); //For each link in the list, foreach (var x in Links) { //Fill the updatelink object with information from the list. updateLink = _context.ProfileLink.FirstOrDefault(l => l.Id == x.Id); //If the input that matches that link is empty the link is deleted. if (Request.Form[x.Id.ToString()].ToString().Length == 0) { _context.ProfileLink.Remove(updateLink); } //Else the link is updated with new information. else { updateLink.Link = Request.Form[x.Id.ToString()].ToString(); } //Save changes to the links. _context.SaveChanges(); } } //For each new link input field, adds new links to the database. for (int i = 0; i < 5; i++) { //Create new ProfileLink to add to database. var updateLink = new ProfileLink(); //If the input field is not empty, if (Request.Form["NewLinkId" + i].ToString().Length > 0) { //assigns the user's id to the InstructorId, updateLink.InstructorId = updateUser.Id; //adds the input field's information to the ProfileLink, updateLink.Link = Request.Form["NewLinkId" + i].ToString(); //and adds the new link to the datatable and saves the changes. _context.ProfileLink.Add(updateLink); _context.SaveChanges(); } } return(RedirectToPage("/Profile")); }