Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4002222

Browse files
Merge pull request #22 from YunusOzdemirr/Yunus
CategoryAndArticleManager
2 parents 238ba43 + 6709140 commit 4002222

File tree

8 files changed

+207
-97
lines changed

8 files changed

+207
-97
lines changed

‎src/v2/CmnSoftwareBackend.API/Controllers/CategoryAndArticlesController.cs‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
5+
using CmnSoftwareBackend.Entities.ComplexTypes;
56
using CmnSoftwareBackend.Entities.Dtos.CategoryAndArticleDtos;
67
using CmnSoftwareBackend.Services.Abstract;
78
using CmnSoftwareBackend.Shared.Utilities.Results.Concrete;
@@ -42,6 +43,35 @@ public async Task<IActionResult> HardDeleteAsync(CategoryAndArticlesUpdateDto ca
4243
var result = await _categoryAndArticleService.HardDeleteAsync(categoryAndArticlesUpdateDto);
4344
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "CategoryAndArticles", Action = "HardDelete" })));
4445
}
46+
[HttpGet]
47+
[Route("[action]")]
48+
public async Task<IActionResult> GetAllAsync(bool isAscending,int currentPage,int pageSize,OrderBy orderBy,bool includeArticle,bool includeCategory)
49+
{
50+
var result = await _categoryAndArticleService.GetAllAsync(isAscending,currentPage,pageSize,orderBy,includeArticle,includeCategory);
51+
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "CategoryAndArticles", Action = "GetAll" })));
52+
}
53+
[HttpPost]
54+
[Route("[action]")]
55+
public async Task<IActionResult> UpdateAsync(CategoryAndArticlesUpdateDto categoryAndArticlesUpdateDto)
56+
{
57+
var result = await _categoryAndArticleService.UpdateAsync(categoryAndArticlesUpdateDto);
58+
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "CategoryAndArticles", Action = "Update" })));
59+
}
60+
[HttpGet]
61+
[Route("[action]")]
62+
public async Task<IActionResult> GetArticleByCategoryId(int categoryId)
63+
{
64+
var result = await _categoryAndArticleService.GetArticleByCategoryId(categoryId);
65+
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "CategoryAndArticles", Action = "GetArticleByCategoryId" })));
66+
}
67+
[HttpGet]
68+
[Route("[action]")]
69+
public async Task<IActionResult> GetCategoryByArticleId(int articleId)
70+
{
71+
var result = await _categoryAndArticleService.GetCategoryByArticleId(articleId);
72+
return Ok(new SuccessDataApiResult(result, Url.Link("", new { Controller = "CategoryAndArticles", Action = "GetCategoryByArticleId" })));
73+
}
74+
4575

4676

4777
}

‎src/v2/CmnSoftwareBackend.API/c:\temp\cmn-internal-nlog.txt‎

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7152,3 +7152,91 @@ ClientConnectionId:00000000-0000-0000-0000-000000000000
71527152
2021年10月05日 02:03:57.3986 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
71537153
2021年10月05日 02:03:57.4828 Info Configuration initialized.
71547154
2021年10月05日 02:03:57.4837 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
7155+
2021年10月06日 10:24:57.8115 Info Message Template Auto Format enabled
7156+
2021年10月06日 10:24:57.8375 Info Loading assembly: NLog.Web.AspNetCore
7157+
2021年10月06日 10:24:57.8843 Info Adding target FileTarget(Name=allfile)
7158+
2021年10月06日 10:24:57.8855 Info Adding target FileTarget(Name=ownFile-web)
7159+
2021年10月06日 10:24:57.8962 Info Adding target DatabaseTarget(Name=database)
7160+
2021年10月06日 10:24:57.9851 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
7161+
2021年10月06日 10:24:58.1103 Info Configuration initialized.
7162+
2021年10月06日 10:24:58.1113 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
7163+
2021年10月06日 10:25:13.2154 Error DatabaseTarget(Name=database): Error when writing to database. Exception: System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)
7164+
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
7165+
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
7166+
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
7167+
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
7168+
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
7169+
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
7170+
at System.Data.SqlClient.SqlConnection.Open()
7171+
at NLog.Targets.DatabaseTarget.OpenConnection(String connectionString, LogEventInfo logEventInfo)
7172+
at NLog.Targets.DatabaseTarget.EnsureConnectionOpen(String connectionString, LogEventInfo logEventInfo)
7173+
at NLog.Targets.DatabaseTarget.WriteLogEventToDatabase(LogEventInfo logEvent, String connectionString)
7174+
ClientConnectionId:00000000-0000-0000-0000-000000000000
7175+
2021年10月06日 10:25:42.7808 Error DatabaseTarget(Name=database): Error when writing to database. Exception: System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)
7176+
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
7177+
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
7178+
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
7179+
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
7180+
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
7181+
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
7182+
at System.Data.SqlClient.SqlConnection.Open()
7183+
at NLog.Targets.DatabaseTarget.OpenConnection(String connectionString, LogEventInfo logEventInfo)
7184+
at NLog.Targets.DatabaseTarget.EnsureConnectionOpen(String connectionString, LogEventInfo logEventInfo)
7185+
at NLog.Targets.DatabaseTarget.WriteLogEventToDatabase(LogEventInfo logEvent, String connectionString)
7186+
ClientConnectionId:00000000-0000-0000-0000-000000000000
7187+
2021年10月06日 10:26:12.3405 Error DatabaseTarget(Name=database): Error when writing to database. Exception: System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)
7188+
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
7189+
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
7190+
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
7191+
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
7192+
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
7193+
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
7194+
at System.Data.SqlClient.SqlConnection.Open()
7195+
at NLog.Targets.DatabaseTarget.OpenConnection(String connectionString, LogEventInfo logEventInfo)
7196+
at NLog.Targets.DatabaseTarget.EnsureConnectionOpen(String connectionString, LogEventInfo logEventInfo)
7197+
at NLog.Targets.DatabaseTarget.WriteLogEventToDatabase(LogEventInfo logEvent, String connectionString)
7198+
ClientConnectionId:00000000-0000-0000-0000-000000000000
7199+
2021年10月06日 10:26:27.3541 Error DatabaseTarget(Name=database): Error when writing to database. Exception: System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)
7200+
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
7201+
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
7202+
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
7203+
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
7204+
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
7205+
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
7206+
at System.Data.SqlClient.SqlConnection.Open()
7207+
at NLog.Targets.DatabaseTarget.OpenConnection(String connectionString, LogEventInfo logEventInfo)
7208+
at NLog.Targets.DatabaseTarget.EnsureConnectionOpen(String connectionString, LogEventInfo logEventInfo)
7209+
at NLog.Targets.DatabaseTarget.WriteLogEventToDatabase(LogEventInfo logEvent, String connectionString)
7210+
ClientConnectionId:00000000-0000-0000-0000-000000000000
7211+
2021年10月06日 10:26:41.3641 Info Message Template Auto Format enabled
7212+
2021年10月06日 10:26:41.3843 Info Loading assembly: NLog.Web.AspNetCore
7213+
2021年10月06日 10:26:41.4248 Info Adding target FileTarget(Name=allfile)
7214+
2021年10月06日 10:26:41.4260 Info Adding target FileTarget(Name=ownFile-web)
7215+
2021年10月06日 10:26:41.4366 Info Adding target DatabaseTarget(Name=database)
7216+
2021年10月06日 10:26:41.5439 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
7217+
2021年10月06日 10:26:41.6421 Info Configuration initialized.
7218+
2021年10月06日 10:26:41.6429 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
7219+
2021年10月06日 10:33:35.7213 Info Message Template Auto Format enabled
7220+
2021年10月06日 10:33:35.7415 Info Loading assembly: NLog.Web.AspNetCore
7221+
2021年10月06日 10:33:35.7788 Info Adding target FileTarget(Name=allfile)
7222+
2021年10月06日 10:33:35.7800 Info Adding target FileTarget(Name=ownFile-web)
7223+
2021年10月06日 10:33:35.7896 Info Adding target DatabaseTarget(Name=database)
7224+
2021年10月06日 10:33:35.8578 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
7225+
2021年10月06日 10:33:35.9745 Info Configuration initialized.
7226+
2021年10月06日 10:33:35.9756 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
7227+
2021年10月06日 10:35:27.9725 Info Message Template Auto Format enabled
7228+
2021年10月06日 10:35:27.9914 Info Loading assembly: NLog.Web.AspNetCore
7229+
2021年10月06日 10:35:28.0277 Info Adding target FileTarget(Name=allfile)
7230+
2021年10月06日 10:35:28.0291 Info Adding target FileTarget(Name=ownFile-web)
7231+
2021年10月06日 10:35:28.0381 Info Adding target DatabaseTarget(Name=database)
7232+
2021年10月06日 10:35:28.1097 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
7233+
2021年10月06日 10:35:28.2083 Info Configuration initialized.
7234+
2021年10月06日 10:35:28.2092 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
7235+
2021年10月06日 10:38:34.4693 Info Message Template Auto Format enabled
7236+
2021年10月06日 10:38:34.4905 Info Loading assembly: NLog.Web.AspNetCore
7237+
2021年10月06日 10:38:34.5269 Info Adding target FileTarget(Name=allfile)
7238+
2021年10月06日 10:38:34.5282 Info Adding target FileTarget(Name=ownFile-web)
7239+
2021年10月06日 10:38:34.5375 Info Adding target DatabaseTarget(Name=database)
7240+
2021年10月06日 10:38:34.6046 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
7241+
2021年10月06日 10:38:34.7030 Info Configuration initialized.
7242+
2021年10月06日 10:38:34.7038 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
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
using System;
22
using System.Collections.Generic;
3+
using CmnSoftwareBackend.Entities.Concrete;
4+
using CmnSoftwareBackend.Shared.Entities.Abstract;
35

46
namespace CmnSoftwareBackend.Entities.Dtos.CategoryAndArticleDtos
57
{
6-
public class CategoryAndArticleListDto
8+
public class CategoryAndArticleListDto:DtoGetBase
79
{
8-
public IEnumerable<CategoryAndArticleDto> CategoryAndArticles { get; set; }
10+
public IEnumerable<CategoryAndArticle> CategoryAndArticles { get; set; }
911
}
1012
}

‎src/v2/CmnSoftwareBackend.Entities/Dtos/CategoryAndArticleDtos/CategoryAndArticlesUpdateDto.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ namespace CmnSoftwareBackend.Entities.Dtos.CategoryAndArticleDtos
33
{
44
public class CategoryAndArticlesUpdateDto
55
{
6-
public int Id { get; set; }
76
public int CategoryId { get; set; }
87
public int ArticleId { get; set; }
98
}

‎src/v2/CmnSoftwareBackend.Services/Abstract/ICategoryAndArticleService.cs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Threading.Tasks;
3+
using CmnSoftwareBackend.Entities.ComplexTypes;
34
using CmnSoftwareBackend.Entities.Dtos.CategoryAndArticleDtos;
45
using CmnSoftwareBackend.Shared.Utilities.Results.Abstract;
56

@@ -9,5 +10,9 @@ public interface ICategoryAndArticleService
910
{
1011
Task<IDataResult> AddAsync(CategoryAndArticleAddDto categoryAndArticleAddDto);
1112
Task<IDataResult> HardDeleteAsync(CategoryAndArticlesUpdateDto categoryAndArticlesUpdateDto);
13+
Task<IDataResult> UpdateAsync(CategoryAndArticlesUpdateDto categoryAndArticlesUpdateDto);
14+
Task<IDataResult> GetAllAsync(bool isAscending, int currentPage, int pageSize, OrderBy orderBy, bool includeArticle, bool includeCategory);
15+
Task<IDataResult> GetArticleByCategoryId(int categoryId);
16+
Task<IDataResult> GetCategoryByArticleId(int articleId);
1217
}
1318
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /