-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
77f8125
commit b698831
Showing
13 changed files
with
256 additions
and
20 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
45 changes: 45 additions & 0 deletions
45
grade-management/Ahk.GradeManagement/Functions/Groups/EditGroupFunction.cs
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,45 @@ | ||
using System.Net; | ||
using System.Threading.Tasks; | ||
using Ahk.GradeManagement.Data.Entities; | ||
using Ahk.GradeManagement.Services.GroupService; | ||
using DTOs; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Azure.Functions.Worker; | ||
using Microsoft.Azure.Functions.Worker.Http; | ||
using Microsoft.Extensions.Logging; | ||
using FromBodyAttribute = Microsoft.Azure.Functions.Worker.Http.FromBodyAttribute; | ||
|
||
namespace Ahk.GradeManagement.Functions.Groups | ||
{ | ||
public class EditGroupFunction | ||
{ | ||
private readonly ILogger _logger; | ||
private readonly IGroupService groupService; | ||
|
||
public EditGroupFunction(ILoggerFactory loggerFactory, IGroupService groupService) | ||
{ | ||
_logger = loggerFactory.CreateLogger<EditGroupFunction>(); | ||
this.groupService = groupService; | ||
} | ||
|
||
[Function("EditGroupFunction")] | ||
public async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "edit-group/{subject}")] HttpRequestData req, string subject, | ||
[FromBody] GroupDTO groupDTO) | ||
{ | ||
_logger.LogInformation("C# HTTP trigger function processed a request."); | ||
|
||
var update = new Group() | ||
{ | ||
Id = groupDTO.Id, | ||
Name = groupDTO.Name, | ||
Time = groupDTO.Time, | ||
Room = groupDTO.Room, | ||
SubjectId = groupDTO.SubjectId, | ||
}; | ||
|
||
await groupService.UpdateGroupAsync(update); | ||
|
||
return new OkResult(); | ||
} | ||
} | ||
} |
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,10 @@ | ||
@page "/edit-group/{groupId}" | ||
|
||
<MudPaper> | ||
<MudTextField Margin="Margin.Normal" @bind-Value="@name" Label="Name"></MudTextField> | ||
<MudTextField Margin="Margin.Normal" @bind-Value="@room" Label="Room"></MudTextField> | ||
<MudTextField Margin="Margin.Normal" @bind-Value="@time" Label="Time"></MudTextField> | ||
</MudPaper> | ||
|
||
|
||
<MudButton Variant="Variant.Filled" Color="Color.Primary" Style="margin:auto" OnClick="() => SubmitAsync()">Submit</MudButton> |
47 changes: 47 additions & 0 deletions
47
review-ui/Ahk.Review.Ui/Pages/GroupPages/EditGroup.razor.cs
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,47 @@ | ||
using Ahk.Review.Ui.Models; | ||
using Ahk.Review.Ui.Services; | ||
using Microsoft.AspNetCore.Components; | ||
using Newtonsoft.Json; | ||
|
||
namespace Ahk.Review.Ui.Pages.GroupPages | ||
{ | ||
public partial class EditGroup : ComponentBase | ||
{ | ||
[Parameter] | ||
public string GroupId { get; set; } | ||
|
||
[Inject] | ||
private GroupService GroupService { get; set; } | ||
[Inject] | ||
private SubjectService SubjectService { get; set; } | ||
[Inject] | ||
private NavigationManager NavigationManager { get; set; } | ||
|
||
private Group group; | ||
|
||
private string name; | ||
private string room; | ||
private string time; | ||
|
||
protected override async void OnInitialized() | ||
{ | ||
group = await GroupService.GetGroupAsync(SubjectService.TenantCode, GroupId); | ||
|
||
name = group.Name; | ||
room = group.Room; | ||
time = group.Time; | ||
|
||
StateHasChanged(); | ||
} | ||
|
||
private async void SubmitAsync() | ||
{ | ||
Group update = group; | ||
update.Name = name; | ||
update.Room = room; | ||
update.Time = time; | ||
|
||
await GroupService.UpdateGroupAsync(SubjectService.TenantCode, update); | ||
} | ||
} | ||
} |
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,5 @@ | ||
@page "/group-details/{groupId}" | ||
|
||
<h3>GroupDetails</h3> | ||
|
||
|
10 changes: 10 additions & 0 deletions
10
review-ui/Ahk.Review.Ui/Pages/GroupPages/GroupDetails.razor.cs
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,10 @@ | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace Ahk.Review.Ui.Pages.GroupPages | ||
{ | ||
public partial class GroupDetails : ComponentBase | ||
{ | ||
[Parameter] | ||
public string GroupId { get; set; } | ||
} | ||
} |
52 changes: 47 additions & 5 deletions
52
review-ui/Ahk.Review.Ui/Pages/SubjectPages/SubjectDetails.razor
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,10 +1,52 @@ | ||
@page "/subject-details" | ||
|
||
<MudPaper Class="pa-4 mb-4"> | ||
<MudStack Row="true"> | ||
<MudTextField @bind-Value="@courseCode" ReadOnly="true" Label="CourseCode"></MudTextField> | ||
<MudTextField @bind-Value="@subjectName" ReadOnly="true" Label="Name"></MudTextField> | ||
</MudStack> | ||
<MudTextField @bind-Value="@semester" ReadOnly="true" Label="Semester"></MudTextField> | ||
<MudTextField @bind-Value="@githubOrg" ReadOnly="true" Label="Github Organization"></MudTextField> | ||
</MudPaper> | ||
|
||
<MudStack Row="true"> | ||
<MudTextField @bind-Value="@courseCode" ReadOnly="true" Label="CourseCode"></MudTextField> | ||
<MudTextField @bind-Value="@subjectName" ReadOnly="true" Label="Name"></MudTextField> | ||
<MudPaper Class="pa-4 mb-4"> | ||
<MudTable Items="groups" T="Group"> | ||
<HeaderContent> | ||
<MudTh>Name</MudTh> | ||
<MudTh>Room</MudTh> | ||
<MudTh>Time</MudTh> | ||
<MudTh>Actions</MudTh> | ||
</HeaderContent> | ||
<RowTemplate> | ||
<MudTd DataLabel="Name">@context.Name</MudTd> | ||
<MudTd DataLabel="Room">@context.Room</MudTd> | ||
<MudTd DataLabel="Time">@context.Time</MudTd> | ||
<MudTd DataLabel="Actions"> | ||
<MudButton Class="ma-2 pa-2" Variant="Variant.Filled" Color="Color.Primary" OnClick="() => ShowGroupDetails(context.Id)">Details</MudButton> | ||
<MudButton Class="ma-2 pa-2" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Create" Color="Color.Secondary" OnClick="() => EditGroup(context.Id)">Edit</MudButton> | ||
<MudButton Class="ma-2 pa-2" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Delete" Color="Color.Error" OnClick="() => DeleteGroup(context.Id)">Delete</MudButton> | ||
</MudTd> | ||
</RowTemplate> | ||
</MudTable> | ||
</MudPaper> | ||
<MudPaper Class="pa-4 mb-4"> | ||
<MudTable Items="assignments" T="Assignment"> | ||
<HeaderContent> | ||
<MudTh>Name</MudTh> | ||
<MudTh>Deadline</MudTh> | ||
<MudTh>Actions</MudTh> | ||
</HeaderContent> | ||
<RowTemplate> | ||
<MudTd DataLabel="Name">@context.Name</MudTd> | ||
<MudTd DataLabel="Deadline">@context.DeadLine</MudTd> | ||
<MudTd DataLabel="Actions"> | ||
<MudButton Class="ma-2 pa-2" Variant="Variant.Filled" Color="Color.Primary" OnClick="() => ShowAssignmentDetails(context.Id)">Details</MudButton> | ||
<MudButton Class="ma-2 pa-2" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Create" Color="Color.Secondary" OnClick="() => EditAssignment(context.Id)">Edit</MudButton> | ||
<MudButton Class="ma-2 pa-2" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Delete" Color="Color.Error" OnClick="() => DeleteAssignment(context.Id)">Delete</MudButton> | ||
</MudTd> | ||
</RowTemplate> | ||
</MudTable> | ||
</MudPaper> | ||
</MudStack> | ||
<MudTextField @bind-Value="@semester" ReadOnly="true" Label="Semester"></MudTextField> | ||
<MudTextField @bind-Value="@githubOrg" ReadOnly="true" Label="Github Organization"></MudTextField> | ||
|
||
|
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
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