Skip to content
Snippets Groups Projects
Commit cfdc46f4 authored by esantangelo's avatar esantangelo
Browse files

fixes

parent d079886c
Branches
No related tags found
No related merge requests found
...@@ -36,7 +36,7 @@ namespace Tsi1.Api.Controllers ...@@ -36,7 +36,7 @@ namespace Tsi1.Api.Controllers
return Ok(result.Data); return Ok(result.Data);
} }
[Authorize(UserTypes.Professor)] [Authorize(Roles = UserTypes.Professor)]
[HttpPost("Create")] [HttpPost("Create")]
public async Task<IActionResult> Create(ForumCreateDto newForum) public async Task<IActionResult> Create(ForumCreateDto newForum)
{ {
...@@ -50,7 +50,7 @@ namespace Tsi1.Api.Controllers ...@@ -50,7 +50,7 @@ namespace Tsi1.Api.Controllers
return Ok(); return Ok();
} }
[Authorize(UserTypes.Professor)] [Authorize(Roles = UserTypes.Professor)]
[HttpDelete("Delete/{forumId}")] [HttpDelete("Delete/{forumId}")]
public async Task<IActionResult> Delete(int forumId) public async Task<IActionResult> Delete(int forumId)
{ {
......
...@@ -61,7 +61,15 @@ namespace Tsi1.Api.Controllers ...@@ -61,7 +61,15 @@ namespace Tsi1.Api.Controllers
var userEmails = await _forumService.GetSubscribedUsers(newPost.ForumId); var userEmails = await _forumService.GetSubscribedUsers(newPost.ForumId);
await _emailService.NotifyNewPostOrMessage(newPost, userEmails.Data); if (userEmails.Data.Any())
{
var resultEmail = await _emailService.NotifyNewPostOrMessage(newPost, userEmails.Data);
if (resultEmail.HasError)
{
return BadRequest(resultEmail.Message);
}
}
return Ok(); return Ok();
} }
......
...@@ -30,7 +30,7 @@ namespace Tsi1.BusinessLayer.Services ...@@ -30,7 +30,7 @@ namespace Tsi1.BusinessLayer.Services
{ {
var result = new ServiceResult<Forum>(); var result = new ServiceResult<Forum>();
var existingForum = _context.Forums var existingForum = await _context.Forums
.FirstOrDefaultAsync(x => x.Name == newForum.Name && x.CourseId == newForum.CourseId); .FirstOrDefaultAsync(x => x.Name == newForum.Name && x.CourseId == newForum.CourseId);
if (existingForum != null) if (existingForum != null)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment