diff options
Diffstat (limited to 'src/MVPtoMVVM')
| -rwxr-xr-x | src/MVPtoMVVM/MVPtoMVVM.csproj | 4 | ||||
| -rwxr-xr-x | src/MVPtoMVVM/domain/TodoItem.cs | 10 | ||||
| -rwxr-xr-x | src/MVPtoMVVM/repositories/IRepository.cs | 12 | ||||
| -rwxr-xr-x | src/MVPtoMVVM/repositories/TodoItemRepository.cs | 26 |
4 files changed, 51 insertions, 1 deletions
diff --git a/src/MVPtoMVVM/MVPtoMVVM.csproj b/src/MVPtoMVVM/MVPtoMVVM.csproj index a6b4aab..f44d42e 100755 --- a/src/MVPtoMVVM/MVPtoMVVM.csproj +++ b/src/MVPtoMVVM/MVPtoMVVM.csproj @@ -40,8 +40,10 @@ <Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Class1.cs" />
+ <Compile Include="domain\TodoItem.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="repositories\IRepository.cs" />
+ <Compile Include="repositories\TodoItemRepository.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
diff --git a/src/MVPtoMVVM/domain/TodoItem.cs b/src/MVPtoMVVM/domain/TodoItem.cs new file mode 100755 index 0000000..0170b98 --- /dev/null +++ b/src/MVPtoMVVM/domain/TodoItem.cs @@ -0,0 +1,10 @@ +using System;
+
+namespace MVPtoMVVM.domain
+{
+ public class TodoItem
+ {
+ public string Description { get; set; }
+ public DateTime DueDate { get; set; }
+ }
+}
\ No newline at end of file diff --git a/src/MVPtoMVVM/repositories/IRepository.cs b/src/MVPtoMVVM/repositories/IRepository.cs new file mode 100755 index 0000000..3593a02 --- /dev/null +++ b/src/MVPtoMVVM/repositories/IRepository.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic;
+using MVPtoMVVM.domain;
+
+namespace MVPtoMVVM.repositories
+{
+ public interface ITodoItemRepository
+ {
+ void Add(TodoItem item);
+ TodoItem Get(string description);
+ IEnumerable<TodoItem> GetAll();
+ }
+}
\ No newline at end of file diff --git a/src/MVPtoMVVM/repositories/TodoItemRepository.cs b/src/MVPtoMVVM/repositories/TodoItemRepository.cs new file mode 100755 index 0000000..fab5e1a --- /dev/null +++ b/src/MVPtoMVVM/repositories/TodoItemRepository.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic;
+using MVPtoMVVM.domain;
+using System.Linq;
+
+namespace MVPtoMVVM.repositories
+{
+ class TodoItemRepository : ITodoItemRepository
+ {
+ private List<TodoItem> items = new List<TodoItem>();
+
+ public void Add(TodoItem item)
+ {
+ items.Add(item);
+ }
+
+ public TodoItem Get(string description)
+ {
+ return items.FirstOrDefault(x => x.Description == description);
+ }
+
+ public IEnumerable<TodoItem> GetAll()
+ {
+ return items.AsEnumerable();
+ }
+ }
+}
\ No newline at end of file |
