Finished student controller and started course controller
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BrightGlimmer.Api.Controllers
|
||||
{
|
||||
@@ -15,9 +17,34 @@ namespace BrightGlimmer.Api.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult<string> Get()
|
||||
public async Task<ActionResult> Get()
|
||||
{
|
||||
return "";
|
||||
return new JsonResult("");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("{id}")]
|
||||
public async Task<ActionResult> Get(Guid id)
|
||||
{
|
||||
return new JsonResult("");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<ActionResult> Create([FromBody]object command)
|
||||
{
|
||||
return new JsonResult("");
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
public async Task<ActionResult> Update([FromBody]object command)
|
||||
{
|
||||
return new JsonResult("");
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<ActionResult> Delete(Guid id)
|
||||
{
|
||||
return new JsonResult("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -22,12 +22,12 @@ namespace BrightGlimmer.Service.Handlers.CommandHandlers
|
||||
|
||||
public async Task<bool> Handle(DeleteStudentCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
/* TODO: CHANGE TO SOFT DELETE */
|
||||
var student = await repository.GetAsync(request.Id);
|
||||
|
||||
student.Address.Delete();
|
||||
student.Address?.Delete();
|
||||
student.AssignedCourses.ToList().ForEach(x => x.Delete());
|
||||
student.Phones.ToList().ForEach(x => x.Delete());
|
||||
student.Delete();
|
||||
|
||||
await repository.UnitOfWork.SaveChangesAsync();
|
||||
return true;
|
||||
|
||||
10
BrightGlimmer.Service/Queries/GetCourseQuery.cs
Normal file
10
BrightGlimmer.Service/Queries/GetCourseQuery.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BrightGlimmer.Service.Queries
|
||||
{
|
||||
class GetCourseQuery
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user