upgrade program et fix class finished

pull/15/head
Matheo THIERRY 2 years ago
parent 6005c16a35
commit 6ce50be142

@ -54,7 +54,7 @@ namespace Biblioteque_de_Class
ModificationDate = DateOnly.FromDateTime(DateTime.Now);
ImageList = new List<NoteImage>();
Collaborators = new List<User>();
Editors = new List<User>();
Editors = new List<User>() { owner };
Owner = owner;
}
@ -74,9 +74,9 @@ namespace Biblioteque_de_Class
/// </summary>
/// <param name="imageLink"></param>
/// <param name="position"></param>
public void AddImage(string imageLink, string position)
public void AddImage(string imageLink, List<int> position)
{
int newname = ImageList.Count + 1;
string newname = (ImageList.Count + 1).ToString();
ImageList.Add(new NoteImage(newname, imageLink, position));
}
@ -85,7 +85,7 @@ namespace Biblioteque_de_Class
/// </summary>
/// <param name="name"></param>
/// <exception cref="NotFoundException"></exception>
public void RemoveImage(int name)
public void RemoveImage(string name)
{
foreach (NoteImage image in ImageList)
{
@ -140,6 +140,7 @@ namespace Biblioteque_de_Class
/// </summary>
public void AddEditor(User owner, User user)
{
if (Editors.Contains(user)) { throw new AlreadyExistException("user already in editors."); }
if (VerifyOwner(owner)) { Editors.Add(user); }
}
@ -148,6 +149,7 @@ namespace Biblioteque_de_Class
/// </summary>
public void RemoveEditor(User owner, User user)
{
if (!Editors.Contains(user)) { throw new NotFoundException("user not found in editors."); }
if (VerifyOwner(owner)) { Editors.Remove(user); }
}

@ -8,11 +8,11 @@ namespace Biblioteque_de_Class
{
public class NoteImage
{
public int Name { get; set; }
public string Name { get; set; }
public string ImageLink { get; set; }
public string Position { get; set; }
public List<int> Position { get; set; }
public NoteImage(int name, string imageLink, string position)
public NoteImage(string name, string imageLink, List<int> position)
{
Name = name;
ImageLink = imageLink;

@ -49,11 +49,11 @@ namespace Biblioteque_de_Class
/// <summary>
/// rechercher une note dans la liste de note de l'utilisateur et la liste de note favoris de l'utilisateur
/// </summary>
public List<Note> SearchNoteByName(List<Note> ToResearchIntoList, string name)
public List<Note> SearchNoteByName(List<Note> toResearchIntoList, string name)
{
List<Note> searchedNotes = new List<Note>();
string search = name.ToLower();
foreach (Note note in ToResearchIntoList)
foreach (Note note in toResearchIntoList)
{
if (note.Name.ToLower().Contains(search))
{
@ -63,6 +63,20 @@ namespace Biblioteque_de_Class
return searchedNotes;
}
public List<Note> SearchNoteByTag(List<Note> toResearchIntoList, string name)
{
List<Note> searchedNotes = new();
Tags tagtoresearchby = GetTagByName(name);
foreach(Note note in toResearchIntoList)
{
if (NoteTagged[note].Contains(tagtoresearchby))
{
searchedNotes.Add(note);
}
}
return searchedNotes;
}
/// <summary>
/// rechercher un tag dans la liste de tag de l'utilisateur
/// </summary>
@ -264,7 +278,7 @@ namespace Biblioteque_de_Class
/// <summary>
/// ajouter un tag a une note
/// </summary>
public void AddTagToNoteList(Note note, Tags tagToAdd)
public void AddTagFromNoteList(Note note, Tags tagToAdd)
{
if (!TagList.Contains(tagToAdd))
{

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save