Finished student controller and started course controller

This commit is contained in:
2019-05-03 13:56:16 -05:00
parent 1ee8747c8e
commit 08c92753f1
4 changed files with 41 additions and 4 deletions

View File

@@ -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.

View File

@@ -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;

View File

@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BrightGlimmer.Service.Queries
{
class GetCourseQuery
{
}
}