public void Edit(string profileName) { var profiles = _store.Retrieve().ToList(); var possibleProfiles = profiles.Where(p => p.Name.Equals(profileName, StringComparison.OrdinalIgnoreCase)); if (possibleProfiles.Count() != 1) { return; } _editingProfile = possibleProfiles.First(); Profile newProfile; if (DHCP) { newProfile = Profile.CreateDHCPProfile(Name); } if (DNS != IPAddress.Any) { newProfile = Profile.CreateStaticProfile(Name, IP, Subnet, Gateway, new IPAddress[] { DNS }); } if (Gateway != IPAddress.Any) { newProfile = Profile.CreateStaticProfile(Name, IP, Subnet, Gateway); } else { newProfile = Profile.CreateStaticProfile(Name, IP, Subnet); } profiles.Remove(_editingProfile); profiles.Add(newProfile); _store.Store(profiles); }
/// <summary> /// Fetch and save a linkedin profile /// </summary> /// <param name="publicUrl"> /// the url to the public profile in linkedin /// should look like: https://il.linkedin.com/in/degoltz /// </param> /// <returns></returns> public Profile Post([FromBody] string publicUrl) { var profile = _profileProvider.GetProfile(publicUrl); _profileStore.Store(profile); return(profile); }