using Model.Dice.Faces; using System.Collections.Generic; using System.Linq; namespace Model.Dice { public class DieManager : IManager>>> { private readonly Dictionary>> diceGroups = new(); public KeyValuePair>> Add(KeyValuePair>> toAdd) { diceGroups.Add(toAdd.Key, toAdd.Value); return toAdd; } public IEnumerable>>> GetAll() { return diceGroups.AsEnumerable(); } public KeyValuePair>> GetOneByName(string name) { return new KeyValuePair>>(name, diceGroups[name]); } public void Remove(KeyValuePair>> toRemove) { diceGroups.Remove(toRemove.Key); } public KeyValuePair>> Update(KeyValuePair>> before, KeyValuePair>> after) { // check if key 1 exists // check if both keys same diceGroups.Remove(before.Key); diceGroups.Add(after.Key, after.Value); return after; } } }