lmplement all actions

This commit is contained in:
2023-10-17 00:33:44 +02:00
parent fc98f99eda
commit 7ee50442c5
10 changed files with 143 additions and 1 deletions

View File

@@ -17,6 +17,23 @@ namespace GerbilManager.Repositories
}
public Gerbil GetGerbil(Guid id) => _gerbilList.SingleOrDefault(x => x.Id == id);
public void CreateGerbil(Gerbil gerbil)
{
_gerbilList.Add(gerbil);
}
public void UpdateGerbil(Gerbil gerbil)
{
var index = this._gerbilList.FindIndex(existingGerbil => existingGerbil.Id == gerbil.Id);
_gerbilList[index] = gerbil;
}
public void DeleteGerbil(Gerbil gerbil)
{
var index = this._gerbilList.FindIndex(existingGerbil => existingGerbil.Id == gerbil.Id);
_gerbilList.RemoveAt(index);
}
}
}