Mercurial > altnet-hispano
diff Agendas/trunk/src/Agendas.Repositories.Memory/RepositoryBase.cs @ 137:2d1adbaf0373
CRUD de Patrocinador
author | nelopauselli |
---|---|
date | Thu, 28 Jul 2011 09:26:24 -0300 |
parents | 65bbcdd5d357 |
children |
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Repositories.Memory/RepositoryBase.cs Tue Jul 26 14:33:49 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Repositories.Memory/RepositoryBase.cs Thu Jul 28 09:26:24 2011 -0300 @@ -8,6 +8,12 @@ { protected static readonly IDictionary<Guid, T> Objects = new Dictionary<Guid, T>(); + public T Get(Guid id) + { + T value; + return Objects.TryGetValue(id, out value) ? value : null; + } + public void Save(T obj) { if (obj.Id==Guid.Empty) @@ -20,5 +26,11 @@ Objects.Add(obj.Id, obj); } + public void Delete(T obj) + { + Objects.Remove(obj.Id); + } + + } } \ No newline at end of file