Simplified Repository, Logic handles more by itself
This commit is contained in:
@@ -9,12 +9,12 @@ public class PasswordStoreService : IPasswordStoreService
|
||||
|
||||
public void Create(PasswordStore item)
|
||||
{
|
||||
Create(item);
|
||||
repository.Create(item);
|
||||
}
|
||||
|
||||
public void Delete(uint ID)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
repository.Delete(ID);
|
||||
}
|
||||
|
||||
public void Delete(PasswordStore item)
|
||||
@@ -24,16 +24,18 @@ public class PasswordStoreService : IPasswordStoreService
|
||||
|
||||
public void Edit(uint ID, PasswordStore newItem)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
repository.Delete(ID);
|
||||
newItem.ID = ID;
|
||||
repository.Create(newItem);
|
||||
}
|
||||
|
||||
public PasswordStore Get(uint ID)
|
||||
{
|
||||
return repository.Get(ID);
|
||||
return repository.GetAll().FirstOrDefault(i => i.ID == ID) ?? throw new Exception("Item not found");
|
||||
}
|
||||
|
||||
public IEnumerable<PasswordStore> GetAll()
|
||||
{
|
||||
return (IEnumerable<PasswordStore>)repository.GetAll();
|
||||
return repository.GetAll();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user