Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 29 additions & 14 deletions src/v2/CmnSoftwareBackend.API/Controllers/ArticlesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,39 @@ public ArticlesController(IArticleService articleService)

[HttpGet]
[ProducesResponseType(200)]

[Route("[action]")]
public async Task<IActionResult> GetAllAsync(bool? isActive, bool? isDeleted, bool isAscending, int currentPage, int pageSize, OrderBy orderBy, bool includeArticlePicture)
public async Task<IActionResult> GetAllAsync(bool? isActive, bool? isDeleted, bool isAscending, int currentPage, int pageSize, OrderBy orderBy, bool includeArticlePicture, bool includeCommentWithoutUser, bool includeCommentWithUser)
{
var result = await _articleService.GetAllAsync(isActive, isDeleted, isAscending, currentPage, pageSize, orderBy, includeArticlePicture);
var result = await _articleService.GetAllAsync(isActive, isDeleted, isAscending, currentPage, pageSize, orderBy, includeArticlePicture, includeCommentWithoutUser, includeCommentWithUser);
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "Articles", Action = "GetAll" })));
}
[HttpGet]
[ProducesResponseType(200)]
[Route("[action]")]
public async Task<IActionResult> GetById(int articleId, bool includeArticlePicture)
public async Task<IActionResult> GetById(int articleId, bool includeArticlePicture, bool commentWithUser ,bool commentWithoutUser)
{
var result = await _articleService.GetByIdAsync(articleId, includeArticlePicture);
var result = await _articleService.GetByIdAsync(articleId, includeArticlePicture, commentWithUser, commentWithoutUser);
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "Articles", Action = "GetById" })));
}
[HttpGet]
[ProducesResponseType(200)]
[Route("[action]")]
public async Task<IActionResult> GetArticleByCommentWithoutUserId(int commentWithoutUserId)
{
var result = await _articleService.GetArticleByCommentWithoutUserIdAsync(commentWithoutUserId);
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "Articles", Action = "GetArticleByCommentWithoutUserId" })));
}
[HttpGet]
[ProducesResponseType(200)]
[Route("[action]")]
public async Task<IActionResult> GetArticleByCommentWithUserId(int commentWithUserId)
{
var result = await _articleService.GetArticleByCommentWithUserIdAsync(commentWithUserId);
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "Articles", Action = "GetArticleByCommentWithUserId" })));
}
[HttpGet]
[ProducesResponseType(200)]
[Route("[action]")]
public async Task<IActionResult> GetArticleByUserId(Guid userId)
{
var article = await _articleService.GetArticleByUserId(userId);
Expand All @@ -55,8 +70,8 @@ public async Task<IActionResult> GetArticleByUserId(Guid userId)
[Route("[action]")]
public async Task<IActionResult> GetArticleByArticlePictureId(int ArticlePictureId)
{
var articles =await _articleService.GetArticleByArticlePictureId(ArticlePictureId);
return Ok(new SuccessDataApiResult(articles,Url.Link("",new {Controller="Articles",Action="GetArticleByArticlePictureId" })));
var articles = await _articleService.GetArticleByArticlePictureId(ArticlePictureId);
return Ok(new SuccessDataApiResult(articles, Url.Link("", new { Controller = "Articles", Action = "GetArticleByArticlePictureId" })));
}

[HttpPost]
Expand All @@ -72,30 +87,30 @@ public async Task<IActionResult> AddAsync(ArticleAddDto articleAddDto)
[ProducesResponseType(400)]
[ProducesResponseType(500)]
[Route("[action]")]
public async Task<IActionResult> DeleteAsync(ArticleAddDto articleAddDto)
public async Task<IActionResult> DeleteAsync(int articleId, Guid CreatedUserId)
{
var result = await _articleService.AddAsync(articleAddDto);
var result = await _articleService.DeleteAsync(articleId, CreatedUserId);
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "Articles", Action = "Delete" })));
}
[HttpPost]
[ProducesResponseType(200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
[Route("[action]")]
public async Task<IActionResult> UpdateAsync(ArticleAddDto articleAddDto)
public async Task<IActionResult> UpdateAsync(ArticleUpdateDto articleUpdateDto)
{
var result = await _articleService.AddAsync(articleAddDto);
var result = await _articleService.UpdateAsync(articleUpdateDto);
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "Articles", Action = "Update" })));
}
[HttpPost]
[ProducesResponseType(200)]
[ProducesResponseType(400)]
[ProducesResponseType(500)]
[Route("[action]")]
public async Task<IActionResult> HardDeleteAsync(ArticleAddDto articleAddDto)
public async Task<IActionResult> HardDeleteAsync(int articleId)
{
var result = await _articleService.AddAsync(articleAddDto);
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "Articles", Action = "HardDelete" })));
var result = await _articleService.HardDeleteAsync(articleId);
return Ok(new SuccessApiResult(result, Url.Link("", new { Controller = "Articles", Action = "HardDelete" })));
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,49 @@ public CommentWithUsersController(ICommentWithUserService commentWithUserService
{
_commentWithUserService = commentWithUserService;
}
[HttpGet]
[Route("[action]")]
public async Task<IActionResult> GetAllAsync(bool? isActive, bool? isDeleted, bool isAscending, int currentPage, int pageSize, OrderBy orderBy, bool includeArticle, bool includeUser)
{
var result = await _commentWithUserService.GetAllAsync(isActive, isDeleted, isAscending, currentPage, pageSize, orderBy, includeArticle, includeUser);
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "CommentWithUser", Action = "GetAll" })));
}
[HttpGet]
[Route("[action]")]
public async Task<IActionResult> GetByIdAsync(int commentWithUserId, bool includeArticle)
public async Task<IActionResult> GetByIdAsync(int commentWithUserId, bool includeArticle,bool includeUser)
{
var result = await _commentWithUserService.GetByIdAsync(commentWithUserId, includeArticle);
var result = await _commentWithUserService.GetByIdAsync(commentWithUserId, includeArticle,includeUser);
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "CommentWithUser", Action = "GetById" })));
}
[HttpPost]
[Route("[action]")]
public async Task<IActionResult> AddAsync(CommentWithUserAddDto commentWithUserAddDto)
{
var result = await _commentWithUserService.AddAsync(commentWithUserAddDto);
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "CommentWithUser", Action = "Add" })));
}
[HttpPost]
[Route("[action]")]
public async Task<IActionResult> UpdateAsync(CommentWithUserUpdateDto commentWithUserUpdateDto)
{
var result = await _commentWithUserService.UpdateAsync(commentWithUserUpdateDto);
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "CommentWithUser", Action = "Update" })));
}
[HttpGet]
[Route("[action]")]
public async Task<IActionResult> GetCommentByUserId(Guid userId, bool includeArticle)
{
var result =await _commentWithUserService.GetAllCommentByUserId(userId, includeArticle);
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "CommentWithUser", Action = "GetCommentByUserId" })));
}
[HttpPost]
[Route("[action]")]
public async Task<IActionResult> DeleteAsync(int commentWithUserId, Guid CreatedByUserId)
{
var result = await _commentWithUserService.DeleteAsync(commentWithUserId, CreatedByUserId);
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "CommentWithUser", Action = "GetCommentByUserId" })));
}

[HttpPost]
[Route("[action]")]
public async Task<IActionResult> HardDeleteAsync(int commentId)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,42 @@ public CommentWithoutUsersController(ICommentWithoutUserService commentWithoutUs
{
_commentWithoutUserService = commentWithoutUserService;
}

[HttpGet]
[Route("[action]")]
public async Task<IActionResult> GetAllAsync(bool? isActive, bool? isDeleted, bool isAscending, int currentPage, int pageSize, OrderBy orderBy, bool includeArticle)
{
var result = await _commentWithoutUserService.GetAllAsync(isActive, isDeleted, isAscending, currentPage, pageSize, orderBy, includeArticle);
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "CommentWithoutUser", Action = "GetAll" })));
}
[HttpGet]
[Route("[action]")]
public async Task<IActionResult> GetByIdAsync(int commentWithoutUserId, bool includeArticle)
{
var result = await _commentWithoutUserService.GetByIdAsync(commentWithoutUserId, includeArticle);
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "CommentWithoutUser", Action = "GetById" })));
}
[HttpPost]
[Route("[action]")]
public async Task<IActionResult> AddAsync(CommentWithoutUserAddDto commentWithoutUserAddDto)
{
var result = await _commentWithoutUserService.AddAsync(commentWithoutUserAddDto);
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "CommentWithoutUser", Action = "Add" })));
}
[HttpPost]
[Route("[action]")]
public async Task<IActionResult> DeleteAsync(int commentWithoutUserId)
{
var result = await _commentWithoutUserService.DeleteAsync(commentWithoutUserId);
return Ok(new SuccessDataApiResult(result,Url.Link("",new {Controller="CommentWithotUser",Action="Delete" })));
}
[HttpPost]
[Route("[action]")]
public async Task<IActionResult> HardDeleteAsync(int commentWithoutUserId)
{
var result = await _commentWithoutUserService.HardDeleteAsync(commentWithoutUserId);
return Ok(new SuccessApiResult(result, Url.Link("", new { Controller = "CommentWithoutUser", Action = "HardDelete" })));
}
[HttpPost]
[Route("[action]")]
public async Task<IActionResult> UpdateAsync(CommentWithoutUserUpdateDto commentWithoutUserUpdateDto)
{
Expand Down
64 changes: 64 additions & 0 deletions src/v2/CmnSoftwareBackend.API/c:\temp\cmn-internal-nlog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6361,3 +6361,67 @@ ClientConnectionId:00000000-0000-0000-0000-000000000000
at NLog.Targets.DatabaseTarget.EnsureConnectionOpen(String connectionString, LogEventInfo logEventInfo)
at NLog.Targets.DatabaseTarget.WriteLogEventToDatabase(LogEventInfo logEvent, String connectionString)
ClientConnectionId:00000000-0000-0000-0000-000000000000
2021-09-29 16:51:55.7066 Info Message Template Auto Format enabled
2021-09-29 16:51:55.7255 Info Loading assembly: NLog.Web.AspNetCore
2021-09-29 16:51:55.7613 Info Adding target FileTarget(Name=allfile)
2021-09-29 16:51:55.7625 Info Adding target FileTarget(Name=ownFile-web)
2021-09-29 16:51:55.7713 Info Adding target DatabaseTarget(Name=database)
2021-09-29 16:51:55.8414 Info Validating config: TargetNames=allfile, ownFile-web, database, ConfigItems=75, FilePath=/Users/yunus/Documents/GitHub/BlogApi-ASP.NET-Core/src/v2/CmnSoftwareBackend.API/bin/Debug/net5.0/NLog.config
2021-09-29 16:51:55.9466 Info Configuration initialized.
2021-09-29 16:51:55.9474 Info NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 4.7.11.13229. Product version: 4.7.11+33ed3a9f86277651e93ddf39cda64a046a06778b. GlobalAssemblyCache: False
2021-09-29 16:54:07.4566 Info Message Template Auto Format enabled
2021-09-29 16:54:07.4780 Info Loading assembly: NLog.Web.AspNetCore
2021-09-29 16:54:07.5156 Info Adding target FileTarget(Name=allfile)
2021-09-29 16:54:07.5170 Info Adding target FileTarget(Name=ownFile-web)
2021-09-29 16:54:07.5267 Info Adding target DatabaseTarget(Name=database)
2021-09-29 16:54:07.6109 Info Validating config: TargetNames=allfile, ownFile-web, database, ConfigItems=75, FilePath=/Users/yunus/Documents/GitHub/BlogApi-ASP.NET-Core/src/v2/CmnSoftwareBackend.API/bin/Debug/net5.0/NLog.config
2021-09-29 16:54:07.6994 Info Configuration initialized.
2021-09-29 16:54:07.7019 Info NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 4.7.11.13229. Product version: 4.7.11+33ed3a9f86277651e93ddf39cda64a046a06778b. GlobalAssemblyCache: False
2021-09-29 17:00:13.9639 Info Message Template Auto Format enabled
2021-09-29 17:00:13.9923 Info Loading assembly: NLog.Web.AspNetCore
2021-09-29 17:00:14.0430 Info Adding target FileTarget(Name=allfile)
2021-09-29 17:00:14.0445 Info Adding target FileTarget(Name=ownFile-web)
2021-09-29 17:00:14.0548 Info Adding target DatabaseTarget(Name=database)
2021-09-29 17:00:14.1550 Info Validating config: TargetNames=allfile, ownFile-web, database, ConfigItems=75, FilePath=/Users/yunus/Documents/GitHub/BlogApi-ASP.NET-Core/src/v2/CmnSoftwareBackend.API/bin/Debug/net5.0/NLog.config
2021-09-29 17:00:14.3285 Info Configuration initialized.
2021-09-29 17:00:14.3303 Info NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 4.7.11.13229. Product version: 4.7.11+33ed3a9f86277651e93ddf39cda64a046a06778b. GlobalAssemblyCache: False
2021-09-29 17:13:21.5045 Info Message Template Auto Format enabled
2021-09-29 17:13:21.5210 Info Loading assembly: NLog.Web.AspNetCore
2021-09-29 17:13:21.5593 Info Adding target FileTarget(Name=allfile)
2021-09-29 17:13:21.5608 Info Adding target FileTarget(Name=ownFile-web)
2021-09-29 17:13:21.5712 Info Adding target DatabaseTarget(Name=database)
2021-09-29 17:13:21.6511 Info Validating config: TargetNames=allfile, ownFile-web, database, ConfigItems=75, FilePath=/Users/yunus/Documents/GitHub/BlogApi-ASP.NET-Core/src/v2/CmnSoftwareBackend.API/bin/Debug/net5.0/NLog.config
2021-09-29 17:13:21.7657 Info Configuration initialized.
2021-09-29 17:13:21.7657 Info NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 4.7.11.13229. Product version: 4.7.11+33ed3a9f86277651e93ddf39cda64a046a06778b. GlobalAssemblyCache: False
2021-09-29 17:46:50.9922 Info Message Template Auto Format enabled
2021-09-29 17:46:51.0125 Info Loading assembly: NLog.Web.AspNetCore
2021-09-29 17:46:51.0497 Info Adding target FileTarget(Name=allfile)
2021-09-29 17:46:51.0508 Info Adding target FileTarget(Name=ownFile-web)
2021-09-29 17:46:51.0602 Info Adding target DatabaseTarget(Name=database)
2021-09-29 17:46:51.1538 Info Validating config: TargetNames=allfile, ownFile-web, database, ConfigItems=75, FilePath=/Users/yunus/Documents/GitHub/BlogApi-ASP.NET-Core/src/v2/CmnSoftwareBackend.API/bin/Debug/net5.0/NLog.config
2021-09-29 17:46:51.2403 Info Configuration initialized.
2021-09-29 17:46:51.2411 Info NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 4.7.11.13229. Product version: 4.7.11+33ed3a9f86277651e93ddf39cda64a046a06778b. GlobalAssemblyCache: False
2021-09-29 17:49:31.3686 Info Message Template Auto Format enabled
2021-09-29 17:49:31.3895 Info Loading assembly: NLog.Web.AspNetCore
2021-09-29 17:49:31.4269 Info Adding target FileTarget(Name=allfile)
2021-09-29 17:49:31.4285 Info Adding target FileTarget(Name=ownFile-web)
2021-09-29 17:49:31.4381 Info Adding target DatabaseTarget(Name=database)
2021-09-29 17:49:31.5269 Info Validating config: TargetNames=allfile, ownFile-web, database, ConfigItems=75, FilePath=/Users/yunus/Documents/GitHub/BlogApi-ASP.NET-Core/src/v2/CmnSoftwareBackend.API/bin/Debug/net5.0/NLog.config
2021-09-29 17:49:31.6204 Info Configuration initialized.
2021-09-29 17:49:31.6212 Info NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 4.7.11.13229. Product version: 4.7.11+33ed3a9f86277651e93ddf39cda64a046a06778b. GlobalAssemblyCache: False
2021-09-29 17:57:09.1053 Info Message Template Auto Format enabled
2021-09-29 17:57:09.1243 Info Loading assembly: NLog.Web.AspNetCore
2021-09-29 17:57:09.1601 Info Adding target FileTarget(Name=allfile)
2021-09-29 17:57:09.1613 Info Adding target FileTarget(Name=ownFile-web)
2021-09-29 17:57:09.1703 Info Adding target DatabaseTarget(Name=database)
2021-09-29 17:57:09.2386 Info Validating config: TargetNames=allfile, ownFile-web, database, ConfigItems=75, FilePath=/Users/yunus/Documents/GitHub/BlogApi-ASP.NET-Core/src/v2/CmnSoftwareBackend.API/bin/Debug/net5.0/NLog.config
2021-09-29 17:57:09.3245 Info Configuration initialized.
2021-09-29 17:57:09.3254 Info NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 4.7.11.13229. Product version: 4.7.11+33ed3a9f86277651e93ddf39cda64a046a06778b. GlobalAssemblyCache: False
2021-09-29 18:28:32.8768 Info Message Template Auto Format enabled
2021-09-29 18:28:32.8979 Info Loading assembly: NLog.Web.AspNetCore
2021-09-29 18:28:32.9334 Info Adding target FileTarget(Name=allfile)
2021-09-29 18:28:32.9346 Info Adding target FileTarget(Name=ownFile-web)
2021-09-29 18:28:32.9440 Info Adding target DatabaseTarget(Name=database)
2021-09-29 18:28:33.0378 Info Validating config: TargetNames=allfile, ownFile-web, database, ConfigItems=75, FilePath=/Users/yunus/Documents/GitHub/BlogApi-ASP.NET-Core/src/v2/CmnSoftwareBackend.API/bin/Debug/net5.0/NLog.config
2021-09-29 18:28:33.1284 Info Configuration initialized.
2021-09-29 18:28:33.1291 Info NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 4.7.11.13229. Product version: 4.7.11+33ed3a9f86277651e93ddf39cda64a046a06778b. GlobalAssemblyCache: False
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ namespace CmnSoftwareBackend.Services.Abstract
{
public interface IArticlePictureService
{
Task<IDataResult> GetAllAsync(bool? isActive, bool? isDeleted, bool isAscending, int currentPage, int pageSize, OrderBy orderBy,bool includeArticle);
Task<IDataResult> GetAllWithoutPagingAsync(bool? isActive, bool? isDeleted, OrderBy orderBy, bool isAscending,bool includeArticle);
Task<IDataResult> GetArticlePictureByArticleId(int articleId);
Task<IDataResult> GetByIdAsync(int articlePictureId,bool includeArticle);
Task<IDataResult> GetAllAsync(bool? isActive, bool? isDeleted, bool isAscending, int currentPage, int pageSize, OrderBy orderBy, bool includeArticle);
Task<IDataResult> GetAllWithoutPagingAsync(bool? isActive, bool? isDeleted, OrderBy orderBy, bool isAscending, bool includeArticle);
Task<IDataResult> GetArticlePictureByArticleId(int articleId);
Task<IDataResult> GetByIdAsync(int articlePictureId, bool includeArticle);
Task<IDataResult> AddAsync(ArticlePictureAddDto articlePictureAddDto);
Task<IDataResult> UpdateAsync(ArticlePictureUpdateDto articlePictureUpdateDto);
Task<IDataResult> DeleteAsync(int articlePictureId, Guid CreatedByUserId);
Expand Down
Loading