Skip to content

Commit 629f23a

Browse files
author
Sergei.Pukhovnikov
committed
Some nuget-packages were updated
1 parent 9fbc9a3 commit 629f23a

File tree

11 files changed

+59
-46
lines changed

11 files changed

+59
-46
lines changed

Source/Calabonga.Catalog/Calabonga.Catalog.Data/Calabonga.Catalog.Data.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<ItemGroup>
88
<PackageReference Include="Calabonga.EntityFrameworkCore.UnitOfWork" Version="1.0.8" />
99
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.2.0" />
10-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" />
10+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.6" />
1111
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.2.0" />
1212
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
13-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.4" />
14-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.4" />
13+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.6" />
14+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.6" />
1515
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
1616

1717
</ItemGroup>

Source/Calabonga.Catalog/Calabonga.Catalog.Web/Calabonga.Catalog.Web.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="AutoMapper" Version="8.1.1" />
14-
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.1.1" />
13+
<PackageReference Include="AutoMapper" Version="9.0.0" />
14+
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
1515
<PackageReference Include="Calabonga.EntityFrameworkCore.UnitOfWork" Version="1.0.8" />
16-
<PackageReference Include="Calabonga.EntityFrameworkCore.UnitOfWork.Framework" Version="1.0.0" />
16+
<PackageReference Include="Calabonga.EntityFrameworkCore.UnitOfWork.Framework" Version="1.1.2" />
1717
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.7.0" />
1818
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="2.4.0" />
1919
<PackageReference Include="IdentityServer4.EntityFramework" Version="2.4.0" />
20-
<PackageReference Include="MailKit" Version="2.2.0" />
20+
<PackageReference Include="MailKit" Version="2.3.1.6" />
2121
<PackageReference Include="Microsoft.AspNetCore.App" />
2222
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.2.0" />
2323
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
2424
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
25-
<PackageReference Include="OperationResultCore" Version="1.0.1" />
25+
<PackageReference Include="OperationResultCore" Version="1.1.0" />
2626
<PackageReference Include="PagedListLiteCore" Version="1.0.4" />
2727
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
2828
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="4.0.1" />

Source/Calabonga.Catalog/Calabonga.Catalog.Web/Calabonga.Catalog.Web.xml

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/Calabonga.Catalog/Calabonga.Catalog.Web/Controllers/CloudController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Calabonga.Catalog.Web.Controllers
1313
/// <summary>
1414
///
1515
/// </summary>
16-
public class CloudController: UnitOfWorkController<ApplicationDbContext, ApplicationUser, ApplicationRole>
16+
public class CloudController: UnitOfWorkController<ApplicationUser, ApplicationRole>
1717
{
1818
private readonly ICloudService _cloudService;
1919

Source/Calabonga.Catalog/Calabonga.Catalog.Web/Infrastructure/DependencyInjection/ViewModelFactoriesRegistration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ public static void ViewModelFactories(IServiceCollection services)
2121
{
2222
foreach (var i in type.GetInterfaces())
2323
{
24-
if (!i.IsGenericType || i.GetGenericTypeDefinition() != typeof(IViewModelFactory<,,>))
24+
if (!i.IsGenericType || i.GetGenericTypeDefinition() != typeof(IViewModelFactory<,>))
2525
{
2626
continue;
2727
}
2828

29-
var interfaceType = typeof(IViewModelFactory<,,>).MakeGenericType(i.GetGenericArguments());
29+
var interfaceType = typeof(IViewModelFactory<,>).MakeGenericType(i.GetGenericArguments());
3030
services.AddTransient(interfaceType, type);
3131
}
3232
}

Source/Calabonga.Catalog/Calabonga.Catalog.Web/Infrastructure/Factories/CategoryViewModelFactory.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
using System;
2+
using System.Threading.Tasks;
23
using AutoMapper;
34
using Calabonga.Catalog.Core.Exceptions;
45
using Calabonga.Catalog.Data;
56
using Calabonga.Catalog.Models;
67
using Calabonga.Catalog.Web.Infrastructure.ViewModels.CategoryViewModels;
78
using Calabonga.EntityFrameworkCore.UnitOfWork;
89
using Calabonga.EntityFrameworkCore.UnitOfWork.Framework.Factories;
10+
using Calabonga.OperationResultsCore;
911

1012
namespace Calabonga.Catalog.Web.Infrastructure.Factories
1113
{
@@ -27,24 +29,27 @@ public CategoryViewModelFactory(
2729
}
2830

2931
/// <inheritdoc />
30-
public override CategoryCreateViewModel GenerateForCreate()
32+
public override async Task<OperationResult<CategoryCreateViewModel>> GenerateForCreateAsync()
3133
{
32-
return new CategoryCreateViewModel
34+
var result = new CategoryCreateViewModel
3335
{
3436
Name = "Категория по умолчанию"
3537
};
38+
39+
return await Task.FromResult(OperationResult.CreateResult(result));
3640
}
3741

3842
/// <inheritdoc />
39-
public override CategoryUpdateViewModel GenerateForUpdate(Guid id)
43+
public override async Task<OperationResult<CategoryUpdateViewModel>> GenerateForUpdateAsync(Guid id)
4044
{
41-
var category = _unitOfWork.GetRepository<Category>().GetFirstOrDefault(predicate: x => x.Id == id);
45+
var category = await _unitOfWork.GetRepository<Category>().GetFirstOrDefaultAsync(predicate: x => x.Id == id);
4246
if (category == null)
4347
{
4448
throw new MicroserviceArgumentNullException();
4549
}
4650

47-
return _mapper.Map<CategoryUpdateViewModel>(category);
51+
var mapped = _mapper.Map<CategoryUpdateViewModel>(category);
52+
return OperationResult.CreateResult(mapped);
4853
}
4954
}
5055
}

Source/Calabonga.Catalog/Calabonga.Catalog.Web/Infrastructure/Factories/ProductViewModelFactory.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
using System;
2+
using System.Threading.Tasks;
23
using AutoMapper;
34
using Calabonga.Catalog.Models;
45
using Calabonga.Catalog.Web.Infrastructure.ViewModels.ProductViewModels;
56
using Calabonga.EntityFrameworkCore.UnitOfWork;
67
using Calabonga.EntityFrameworkCore.UnitOfWork.Framework.Exceptions;
78
using Calabonga.EntityFrameworkCore.UnitOfWork.Framework.Factories;
9+
using Calabonga.OperationResultsCore;
810

911
namespace Calabonga.Catalog.Web.Infrastructure.Factories
1012
{
@@ -23,22 +25,24 @@ public ProductViewModelFactory(IMapper mapper, IRepositoryFactory factory)
2325
_repository = factory.GetRepository<Product>();
2426
}
2527

28+
2629
/// <inheritdoc />
27-
public override ProductCreateViewModel GenerateForCreate()
30+
public override Task<OperationResult<ProductCreateViewModel>> GenerateForCreateAsync()
2831
{
29-
return new ProductCreateViewModel();
32+
return Task.FromResult(OperationResult.CreateResult(new ProductCreateViewModel()));
3033
}
3134

3235
/// <inheritdoc />
33-
public override ProductUpdateViewModel GenerateForUpdate(Guid id)
36+
public override async Task<OperationResult<ProductUpdateViewModel>> GenerateForUpdateAsync(Guid id)
3437
{
35-
var item = _repository.GetFirstOrDefault(predicate: x => x.Id == id);
38+
var item = await _repository.GetFirstOrDefaultAsync(predicate: x => x.Id == id);
3639
if (item == null)
3740
{
3841
throw new MicroserviceNotFoundException();
3942
}
4043

41-
return _mapper.Map<ProductUpdateViewModel>(item);
44+
var result = _mapper.Map<ProductUpdateViewModel>(item);
45+
return OperationResult.CreateResult(result);
4246
}
4347
}
4448
}

Source/Calabonga.Catalog/Calabonga.Catalog.Web/Infrastructure/Factories/ReviewViewModelFactory.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Threading.Tasks;
23
using AutoMapper;
34
using Calabonga.Catalog.Models;
45
using Calabonga.Catalog.Web.Infrastructure.Helpers;
@@ -7,6 +8,7 @@
78
using Calabonga.EntityFrameworkCore.UnitOfWork;
89
using Calabonga.EntityFrameworkCore.UnitOfWork.Framework.Exceptions;
910
using Calabonga.EntityFrameworkCore.UnitOfWork.Framework.Factories;
11+
using Calabonga.OperationResultsCore;
1012

1113
namespace Calabonga.Catalog.Web.Infrastructure.Factories
1214
{
@@ -27,32 +29,36 @@ public ReviewViewModelFactory(IMapper mapper, IRepositoryFactory factory, IAccou
2729
_repository = factory.GetRepository<Review>();
2830
}
2931

32+
3033
/// <inheritdoc />
31-
public override ReviewCreateViewModel GenerateForCreate()
34+
public override async Task<OperationResult<ReviewCreateViewModel>> GenerateForCreateAsync()
3235
{
3336
var userName = "Аноним";
34-
var user = AsyncHelper.RunSync(async () => await _accountService.GetCurrentUserAsync());
37+
var user = await _accountService.GetCurrentUserAsync();
3538
if (user != null)
3639
{
3740
userName = $"{user.LastName} {user.FirstName}";
3841
}
3942

40-
return new ReviewCreateViewModel
43+
var result = new ReviewCreateViewModel
4144
{
4245
UserName = userName
4346
};
47+
48+
return OperationResult.CreateResult(result);
4449
}
4550

4651
/// <inheritdoc />
47-
public override ReviewUpdateViewModel GenerateForUpdate(Guid id)
52+
public override async Task<OperationResult<ReviewUpdateViewModel>> GenerateForUpdateAsync(Guid id)
4853
{
49-
var item = _repository.GetFirstOrDefault(predicate: x => x.Id == id);
54+
var item = await _repository.GetFirstOrDefaultAsync(predicate: x => x.Id == id);
5055
if (item == null)
5156
{
5257
throw new MicroserviceNotFoundException();
5358
}
5459

55-
return _mapper.Map<ReviewUpdateViewModel>(item);
60+
var result = _mapper.Map<ReviewUpdateViewModel>(item);
61+
return OperationResult.CreateResult(result);
5662
}
5763
}
5864
}

Source/Calabonga.Catalog/Calabonga.Catalog.Web/Infrastructure/Managers/CategoryManager.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System.Linq;
2-
using AutoMapper;
1+
using AutoMapper;
32
using Calabonga.Catalog.Data;
43
using Calabonga.Catalog.Models;
54
using Calabonga.Catalog.Web.Infrastructure.Providers;
@@ -8,7 +7,6 @@
87
using Calabonga.EntityFrameworkCore.UnitOfWork.Framework.Factories;
98
using Calabonga.EntityFrameworkCore.UnitOfWork.Framework.Managers;
109
using Calabonga.EntityFrameworkCore.UnitOfWork.Framework.Validators;
11-
using Microsoft.EntityFrameworkCore;
1210

1311
namespace Calabonga.Catalog.Web.Infrastructure.Managers
1412
{
@@ -25,7 +23,7 @@ public CategoryManager(
2523
IProductProvider productProvider,
2624
IUnitOfWork<ApplicationDbContext, ApplicationUser, ApplicationRole> unitOfWork,
2725
IMapper mapper,
28-
IViewModelFactory<Category, CategoryCreateViewModel, CategoryUpdateViewModel> viewModelFactory,
26+
IViewModelFactory<CategoryCreateViewModel, CategoryUpdateViewModel> viewModelFactory,
2927
IEntityValidator<Category> validator)
3028
: base(mapper, viewModelFactory, validator)
3129
{

0 commit comments

Comments
 (0)