-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from GuttiDK/develop
Version 0.0.3 (28/09/2023)
- Loading branch information
Showing
10 changed files
with
258 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@page | ||
@using TheTodoService.DataTransferObjects; | ||
@model TheTodoWeb.Pages.DeleteToDoListModel | ||
@{ | ||
ViewData["Title"] = "ToDoList"; | ||
} | ||
|
||
<h3>Delete Completed Tasks</h3> | ||
|
||
<hr /> | ||
|
||
<table class="table table-hover"> | ||
<thead> | ||
<tr> | ||
<th>Id</th> | ||
<th>Description</th> | ||
<th>Created Time</th> | ||
<th>IsCompleted</th> | ||
<th>Priory</th> | ||
<th>Actions</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach (ToDoItemDto item in Model.ToDoItems) | ||
{ | ||
<tr> | ||
<td>@item.Id</td> | ||
<td>@item.TaskDescription</td> | ||
<td>@item.CreatedTime</td> | ||
<td>@item.IsCompleted</td> | ||
<td>@item.Priority</td> | ||
<td> | ||
<form asp-page-handler="Delete" asp-route-id="@item.Id" method="post"> | ||
<button class="btn btn-default">Delete</button> | ||
</form> | ||
</td> | ||
</tr> | ||
} | ||
</tbody> | ||
</table> |
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,44 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
using System.Collections.ObjectModel; | ||
using TheTodoRepository.Models; | ||
using TheTodoService.DataTransferObjects; | ||
using TheTodoService.Interfaces; | ||
|
||
namespace TheTodoWeb.Pages | ||
{ | ||
public class DeleteToDoListModel : PageModel | ||
{ | ||
|
||
private readonly IToDoItemService _toDoItemService; | ||
|
||
public ObservableCollection<ToDoItemDto> ToDoItems = new(); | ||
|
||
public DeleteToDoListModel(IToDoItemService toDoItemService) | ||
{ | ||
_toDoItemService = toDoItemService; | ||
} | ||
|
||
public async Task<IActionResult> OnGet() | ||
{ | ||
ToDoItems = await _toDoItemService.GetAllCompletedAsync(); | ||
|
||
return Page(); | ||
} | ||
|
||
public async Task<IActionResult> OnPostDelete(Guid id) | ||
{ | ||
if (ModelState.IsValid) | ||
{ | ||
ToDoItemDto toDoItemDto = await _toDoItemService.GetByIDAsync(id); | ||
|
||
if (toDoItemDto != null) | ||
{ | ||
await _toDoItemService.DeleteAsync(toDoItemDto); | ||
} | ||
} | ||
|
||
return RedirectToPage("DeleteToDoList"); | ||
} | ||
} | ||
} |
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,4 @@ | ||
@page | ||
@model TheTodoWeb.Pages.EditToDoListModel | ||
@{ | ||
} |
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,35 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
using TheTodoService.DataTransferObjects; | ||
using TheTodoService.Interfaces; | ||
|
||
namespace TheTodoWeb.Pages | ||
{ | ||
public class EditToDoListModel : PageModel | ||
{ | ||
private readonly LinkGenerator linkGenerator; | ||
private readonly IToDoItemService _toDoItemService; | ||
|
||
public EditToDoListModel(LinkGenerator linkGenerator, IToDoItemService toDoItemService) | ||
{ | ||
this.linkGenerator = linkGenerator; | ||
_toDoItemService = toDoItemService; | ||
} | ||
|
||
public async Task OnGetAsync(Guid guid) | ||
{ | ||
string guid1 = linkGenerator.GetPathByRouteValues(HttpContext, "EditToDoList", new { guid }); | ||
|
||
if (guid != null) | ||
{ | ||
ToDoItemDto toDoItemDto = await _toDoItemService.GetByIDAsync(guid); | ||
if (toDoItemDto != null) | ||
{ | ||
} | ||
} | ||
|
||
} | ||
|
||
|
||
} | ||
} |
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 |
---|---|---|
|
@@ -20,5 +20,10 @@ public void OnGet() | |
{ | ||
|
||
} | ||
|
||
public IActionResult OnPost() | ||
{ | ||
return RedirectToPage("ToDoList"); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,32 +1,72 @@ | ||
@page | ||
@page | ||
@using TheTodoService.DataTransferObjects; | ||
@using TheTodoService.Enums; | ||
@model TheTodoWeb.Pages.ToDoListModel | ||
@{ | ||
ViewData["Title"] = "ToDoList"; | ||
} | ||
|
||
<h3>ToDoList</h3> | ||
|
||
<a class="btn btn-primary" data-bs-toggle="offcanvas" href="#offcanvasExample" role="button" aria-controls="offcanvasExample">Create</a> | ||
<hr /> | ||
|
||
<table class="table"> | ||
<thread> | ||
<table class="table table-hover"> | ||
<thead> | ||
<tr> | ||
<th>Id</th> | ||
<th>Description</th> | ||
<th>Created Time</th> | ||
<th>IsCompleted</th> | ||
<th>Created</th> | ||
<th>Completed</th> | ||
<th>Priory</th> | ||
<th>Actions</th> | ||
</tr> | ||
</thread> | ||
</thead> | ||
<tbody> | ||
@foreach (var item in Model.ToDoItems) | ||
@foreach (ToDoItemDto item in Model.ToDoItems) | ||
{ | ||
<tr> | ||
<td>@item.Id</td> | ||
<td>@item.TaskDescription</td> | ||
<td>@item.CreatedTime</td> | ||
<td>@item.IsCompleted</td> | ||
<td>@item.Priority</td> | ||
</tr> | ||
<tr> | ||
<td>@item.Id</td> | ||
<td>@item.TaskDescription</td> | ||
<td>@item.CreatedTime</td> | ||
<td>@item.IsCompleted</td> | ||
<td>@item.Priority</td> | ||
<td> | ||
<a class="btn btn-primary" asp-page="EditToDoList" asp-route-id="@item.Id">Edit</a> | ||
<form method="post" asp-page-handler="Completed" asp-route-id="@item.Id"><a class="btn btn-danger" asp-route-id="@item.Id">Complete</a></form> | ||
<button ></button> | ||
</td> | ||
</tr> | ||
} | ||
</tbody> | ||
</table> | ||
|
||
|
||
<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvasExample" aria-labelledby="offcanvasExampleLabel"> | ||
<div class="offcanvas-header"> | ||
<h5 class="offcanvas-title" id="offcanvasExampleLabel">Offcanvas</h5> | ||
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button> | ||
</div> | ||
<div class="offcanvas-body"> | ||
<div> | ||
Here can you create a new todo item. | ||
<hr /> | ||
</div> | ||
<form method="post" asp-page-handler="CreateTask"> | ||
<div class="input-group mb-3"> | ||
<span class="input-group-text" id="inputGroup-sizing-default">Description</span> | ||
<input type="text" class="form-control" asp-for="Description" id="description" name="description"> | ||
</div> | ||
|
||
<div class="input-group mb-3"> | ||
<label class="input-group-text" for="inputGroupSelect01">Priority</label> | ||
<select class="form-select" asp-for="PriorityForm" name="priorityForm"> | ||
@foreach (PrioryEnumDto priorityEnum in Enum.GetValues(typeof(PrioryEnumDto))) | ||
{ | ||
<option value="@priorityEnum">@priorityEnum</option> | ||
} | ||
</select> | ||
</div> | ||
<button class="btn btn-primary" type="submit">Button</button> | ||
</form> | ||
</div> | ||
</div> |
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
Oops, something went wrong.