-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement simple repository pattern (#1)
Implement simple repository pattern
- Loading branch information
Showing
7 changed files
with
62 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Todo.Core.Model | ||
{ | ||
public class TodoItem | ||
{ | ||
public string Subject { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Microsoft.Graph; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Todo.Core.Repository | ||
{ | ||
public abstract class RepositoryBase | ||
{ | ||
protected IAuthenticationProvider AuthenticationProvider { get; } | ||
|
||
public RepositoryBase(IAuthenticationProvider authenticationProvider) | ||
{ | ||
AuthenticationProvider = authenticationProvider; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.Graph; | ||
using Todo.Core.Model; | ||
|
||
namespace Todo.Core.Repository | ||
{ | ||
public class TodoItemRepository : RepositoryBase, ITodoItemRepository | ||
{ | ||
public TodoItemRepository(IAuthenticationProvider authenticationProvider) | ||
: base(authenticationProvider) | ||
{ | ||
} | ||
|
||
public async Task<IEnumerable<TodoItem>> ListAsync() | ||
{ | ||
var graphServiceClient = new GraphServiceClient(AuthenticationProvider); | ||
var tasks = await graphServiceClient.Me.Outlook.Tasks.Request().GetAsync(); | ||
return tasks.Select(task => new TodoItem() | ||
{ | ||
Subject = task.Subject | ||
}); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.