Skip to content

Commit

Permalink
Merge pull request #27 from Ali-YousefiTelori/develop
Browse files Browse the repository at this point in the history
update package and some logs
  • Loading branch information
Ali-YousefiTelori authored Oct 4, 2023
2 parents 760684f + 6c21170 commit 8514918
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="EasyMicroservices.Cores.AspEntityFrameworkCoreApi" Version="0.0.0.18" />
<PackageReference Include="EasyMicroservices.Cores.AspEntityFrameworkCoreApi" Version="0.0.0.20" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EasyMicroservices.WhiteLabelsMicroservice.Clients" Version="0.0.0.6" />
<PackageReference Include="EasyMicroservices.WhiteLabelsMicroservice.Clients" Version="0.0.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.11" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;

namespace EasyMicroservices.QuestionsMicroservice.WebApi.Controllers
namespace EasyMicroservices.ContentsMicroservice.WebApi.Controllers
{
public class ContentController : SimpleQueryServiceController<ContentEntity, CreateContentRequestContract, UpdateContentRequestContract, ContentContract, long>
{
Expand All @@ -26,7 +26,7 @@ public override async Task<MessageContract<long>> Add(CreateContentRequestContra
var checkCategoryId = await categorylogic.GetById(new GetIdRequestContract<long>() { Id = request.CategoryId });
if (checkLanguageId.IsSuccess && checkCategoryId.IsSuccess)
return await base.Add(request, cancellationToken);
return (EasyMicroservices.ServiceContracts.FailedReasonType.Incorrect, "Language or Categoryid is incorrect");
return (FailedReasonType.Incorrect, "Language or Categoryid is incorrect");
}

public override async Task<MessageContract<ContentContract>> Update(UpdateContentRequestContract request, CancellationToken cancellationToken = default)
Expand All @@ -37,7 +37,7 @@ public override async Task<MessageContract<ContentContract>> Update(UpdateConten
var checkCategoryId = await categorylogic.GetById(new GetIdRequestContract<long>() { Id = request.CategoryId });
if (checkLanguageId.IsSuccess && checkCategoryId.IsSuccess)
return await base.Update(request, cancellationToken);
return (EasyMicroservices.ServiceContracts.FailedReasonType.Incorrect, "Language or Categoryid is incorrect");
return (FailedReasonType.Incorrect, "Language or Categoryid is incorrect");

}

Expand Down Expand Up @@ -72,13 +72,14 @@ public async Task<ListMessageContract<ContentContract>> GetAllByKey(GetAllByKeyR
[HttpPost]
public async Task<MessageContract<CategoryContract>> AddContentWithKey(AddContentWithKeyRequestContract request)
{
Console.WriteLine($"try add {request.Key}!");
using var categorylogic = unitOfWork.GetLongContractLogic<CategoryEntity, CreateCategoryRequestContract, UpdateCategoryRequestContract, CategoryContract>();
using var contentlogic = unitOfWork.GetLongContractLogic<ContentEntity, CreateContentRequestContract, UpdateContentRequestContract, ContentContract>();
using var languageLogic = unitOfWork.GetLongContractLogic<LanguageEntity, LanguageContract>();

var getCategoryResult = await categorylogic.GetBy(x => x.Key == request.Key);
if (getCategoryResult.IsSuccess)
return (FailedReasonType.Duplicate, "Category already exists.");
return (FailedReasonType.Duplicate, $"Category {request.Key} already exists.");

var languages = await languageLogic.GetAll();
var notFoundLanguages = request.LanguageData.Select(x => x.Language).Except(languages.Result.Select(o => o.Name));
Expand Down

0 comments on commit 8514918

Please sign in to comment.