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

fixes

parent d079886c
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,7 @@ namespace Tsi1.Api.Controllers
return Ok(result.Data);
}
[Authorize(UserTypes.Professor)]
[Authorize(Roles = UserTypes.Professor)]
[HttpPost("Create")]
public async Task<IActionResult> Create(ForumCreateDto newForum)
{
......@@ -50,7 +50,7 @@ namespace Tsi1.Api.Controllers
return Ok();
}
[Authorize(UserTypes.Professor)]
[Authorize(Roles = UserTypes.Professor)]
[HttpDelete("Delete/{forumId}")]
public async Task<IActionResult> Delete(int forumId)
{
......
......@@ -61,8 +61,16 @@ namespace Tsi1.Api.Controllers
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();
}
......
......@@ -30,7 +30,7 @@ namespace Tsi1.BusinessLayer.Services
{
var result = new ServiceResult<Forum>();
var existingForum = _context.Forums
var existingForum = await _context.Forums
.FirstOrDefaultAsync(x => x.Name == newForum.Name && x.CourseId == newForum.CourseId);
if (existingForum != null)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment