From c00572696fa2adeefe39d1085d98c68c33eade52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=ABl=20Mugnier?= Date: Mon, 30 Nov 2020 17:52:06 +0100 Subject: [PATCH] =?UTF-8?q?Update=20-=20Mise=20=C3=A0=20jour=20du=20site?= =?UTF-8?q?=20de=20manage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sheaft.Application.Mappers/TagProfile.cs | 9 +++-- .../Controllers/AgreementsController.cs | 2 +- .../Controllers/BankAccountsController.cs | 39 +++++++++++++------ .../Controllers/ConsumersController.cs | 2 +- .../Controllers/DeclarationsController.cs | 2 +- .../Controllers/DeliveryModesController.cs | 2 +- .../Controllers/DepartmentsController.cs | 2 +- .../Controllers/DonationsController.cs | 2 +- .../Controllers/JobsController.cs | 2 +- .../Controllers/LegalsController.cs | 2 +- .../Controllers/LevelsController.cs | 2 +- .../Controllers/OrdersController.cs | 2 +- .../Controllers/PayinsController.cs | 2 +- .../Controllers/PayoutsController.cs | 2 +- .../Controllers/ProducersController.cs | 2 +- .../Controllers/ProductsController.cs | 2 +- .../Controllers/PurchaseOrdersController.cs | 2 +- .../Controllers/RegionsController.cs | 2 +- .../Controllers/ReturnablesController.cs | 2 +- .../Controllers/RewardsController.cs | 2 +- .../Controllers/StoresController.cs | 2 +- .../Controllers/TagsController.cs | 2 +- .../Controllers/TransfersController.cs | 2 +- .../Views/BankAccounts/Create.cshtml | 2 +- .../{Update.cshtml => Edit.cshtml} | 2 +- 25 files changed, 57 insertions(+), 37 deletions(-) rename Sheaft.Web.Manage/Views/BankAccounts/{Update.cshtml => Edit.cshtml} (95%) diff --git a/Sheaft.Application.Mappers/TagProfile.cs b/Sheaft.Application.Mappers/TagProfile.cs index 30b534fcb..7cafde0ae 100644 --- a/Sheaft.Application.Mappers/TagProfile.cs +++ b/Sheaft.Application.Mappers/TagProfile.cs @@ -1,7 +1,8 @@ using AutoMapper; using Sheaft.Domain.Models; using Sheaft.Application.Models; -using System; +using Sheaft.Core.Extensions; +using Sheaft.Core.Models; namespace Sheaft.Application.Mappers { @@ -9,8 +10,10 @@ public class TagProfile : Profile { public TagProfile() { - CreateMap(); - CreateMap(); + CreateMap() + .ForMember(d => d.Picture, opt => opt.MapFrom(r => CoreProductExtensions.GetPictureUrl(r.Picture, PictureSize.LARGE))); + CreateMap() + .ForMember(d => d.Picture, opt => opt.MapFrom(r => CoreProductExtensions.GetPictureUrl(r.Picture, PictureSize.LARGE))); } } } diff --git a/Sheaft.Web.Manage/Controllers/AgreementsController.cs b/Sheaft.Web.Manage/Controllers/AgreementsController.cs index 9115a13d5..12b43d80d 100644 --- a/Sheaft.Web.Manage/Controllers/AgreementsController.cs +++ b/Sheaft.Web.Manage/Controllers/AgreementsController.cs @@ -34,7 +34,7 @@ public AgreementsController( } [HttpGet] - public async Task Index(CancellationToken token, AgreementStatus? status = null, int page = 0, int take = 10) + public async Task Index(CancellationToken token, AgreementStatus? status = null, int page = 0, int take = 25) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/BankAccountsController.cs b/Sheaft.Web.Manage/Controllers/BankAccountsController.cs index 7c05c343e..bf7043688 100644 --- a/Sheaft.Web.Manage/Controllers/BankAccountsController.cs +++ b/Sheaft.Web.Manage/Controllers/BankAccountsController.cs @@ -33,9 +33,8 @@ public BankAccountsController( _logger = logger; } - [HttpGet] - public async Task CreateBankAccount(Guid userId, CancellationToken token) + public async Task Create(Guid userId, CancellationToken token) { var entity = await _context.Users.OfType() .AsNoTracking() @@ -55,7 +54,7 @@ public async Task CreateBankAccount(Guid userId, CancellationToke [HttpPost] [ValidateAntiForgeryToken] - public async Task CreateBankAccount(BankAccountViewModel model, CancellationToken token) + public async Task Create(BankAccountViewModel model, CancellationToken token) { var result = await _mediatr.Process(new CreateBankAccountCommand(await GetRequestUser(token)) { @@ -74,26 +73,44 @@ public async Task CreateBankAccount(BankAccountViewModel model, C return View(model); } - return RedirectToAction("Edit", new { id = model.OwnerId }); + return RedirectToAction("Edit", new { id = result.Data }); } [HttpGet] - public async Task UpdateBankAccount(Guid bankAccountId, CancellationToken token) + public async Task Edit(Guid id, CancellationToken token) { - var entity = await _context.BankAccounts.Get(c => c.Id == bankAccountId) - .ProjectTo(_configurationProvider) - .SingleOrDefaultAsync(token); + var entity = await _context.BankAccounts + .SingleOrDefaultAsync(c => c.Id == id, token); if (entity == null) throw new NotFoundException(); ViewBag.Countries = await GetCountries(token); - return View(entity); + + return View(new BankAccountViewModel + { + Id = entity.Id, + Identifier = entity.Identifier, + BIC = entity.BIC, + IBAN = entity.IBAN, + IsActive = entity.IsActive, + Name = entity.Name, + Owner = entity.Owner, + OwnerId = entity.User.Id, + Address = new AddressViewModel + { + Line1 = entity.Line1, + Line2 = entity.Line2, + City = entity.City, + Zipcode = entity.Zipcode, + Country = entity.Country + } + }); } [HttpPost] [ValidateAntiForgeryToken] - public async Task UpdateBankAccount(BankAccountViewModel model, CancellationToken token) + public async Task Edit(BankAccountViewModel model, CancellationToken token) { var result = await _mediatr.Process(new UpdateBankAccountCommand(await GetRequestUser(token)) { @@ -112,7 +129,7 @@ public async Task UpdateBankAccount(BankAccountViewModel model, C return View(model); } - return RedirectToAction("Edit", new { id = model.OwnerId }); + return RedirectToAction("Edit", new { id = model.Id }); } } } diff --git a/Sheaft.Web.Manage/Controllers/ConsumersController.cs b/Sheaft.Web.Manage/Controllers/ConsumersController.cs index b38163554..8b28e54d3 100644 --- a/Sheaft.Web.Manage/Controllers/ConsumersController.cs +++ b/Sheaft.Web.Manage/Controllers/ConsumersController.cs @@ -35,7 +35,7 @@ public ConsumersController( } [HttpGet] - public async Task Index(CancellationToken token, int page = 0, int take = 10) + public async Task Index(CancellationToken token, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/DeclarationsController.cs b/Sheaft.Web.Manage/Controllers/DeclarationsController.cs index 22941171b..661231e50 100644 --- a/Sheaft.Web.Manage/Controllers/DeclarationsController.cs +++ b/Sheaft.Web.Manage/Controllers/DeclarationsController.cs @@ -35,7 +35,7 @@ public DeclarationsController( } [HttpGet] - public async Task Index(CancellationToken token, int page = 0, int take = 10) + public async Task Index(CancellationToken token, int page = 0, int take = 25) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/DeliveryModesController.cs b/Sheaft.Web.Manage/Controllers/DeliveryModesController.cs index 208ee33c4..1cedd11d5 100644 --- a/Sheaft.Web.Manage/Controllers/DeliveryModesController.cs +++ b/Sheaft.Web.Manage/Controllers/DeliveryModesController.cs @@ -32,7 +32,7 @@ public DeliveryModesController( } [HttpGet] - public async Task Index(CancellationToken token, int page = 0, int take = 10) + public async Task Index(CancellationToken token, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/DepartmentsController.cs b/Sheaft.Web.Manage/Controllers/DepartmentsController.cs index 3f3b05d85..36329c597 100644 --- a/Sheaft.Web.Manage/Controllers/DepartmentsController.cs +++ b/Sheaft.Web.Manage/Controllers/DepartmentsController.cs @@ -32,7 +32,7 @@ public DepartmentsController( } [HttpGet] - public async Task Index(CancellationToken token, int page = 0, int take = 10) + public async Task Index(CancellationToken token, int page = 0, int take = 200) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/DonationsController.cs b/Sheaft.Web.Manage/Controllers/DonationsController.cs index d0112401d..a30cc5d7a 100644 --- a/Sheaft.Web.Manage/Controllers/DonationsController.cs +++ b/Sheaft.Web.Manage/Controllers/DonationsController.cs @@ -33,7 +33,7 @@ public DonationsController( } [HttpGet] - public async Task Index(CancellationToken token, TransactionStatus? status = null, int page = 0, int take = 10) + public async Task Index(CancellationToken token, TransactionStatus? status = null, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/JobsController.cs b/Sheaft.Web.Manage/Controllers/JobsController.cs index 01a3d28eb..55e5d731e 100644 --- a/Sheaft.Web.Manage/Controllers/JobsController.cs +++ b/Sheaft.Web.Manage/Controllers/JobsController.cs @@ -33,7 +33,7 @@ public JobsController( } [HttpGet] - public async Task Index(CancellationToken token, ProcessStatus? status = null, int page = 0, int take = 10) + public async Task Index(CancellationToken token, ProcessStatus? status = null, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/LegalsController.cs b/Sheaft.Web.Manage/Controllers/LegalsController.cs index e3e71a5af..1d755bc52 100644 --- a/Sheaft.Web.Manage/Controllers/LegalsController.cs +++ b/Sheaft.Web.Manage/Controllers/LegalsController.cs @@ -35,7 +35,7 @@ public LegalsController( } [HttpGet] - public async Task Index(CancellationToken token, LegalKind? kind = null, int page = 0, int take = 10) + public async Task Index(CancellationToken token, LegalKind? kind = null, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/LevelsController.cs b/Sheaft.Web.Manage/Controllers/LevelsController.cs index 26ba1fcee..6c2cd7f95 100644 --- a/Sheaft.Web.Manage/Controllers/LevelsController.cs +++ b/Sheaft.Web.Manage/Controllers/LevelsController.cs @@ -32,7 +32,7 @@ public LevelsController( } [HttpGet] - public async Task Index(CancellationToken token, int page = 0, int take = 10) + public async Task Index(CancellationToken token, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/OrdersController.cs b/Sheaft.Web.Manage/Controllers/OrdersController.cs index a112c0352..c7762ec68 100644 --- a/Sheaft.Web.Manage/Controllers/OrdersController.cs +++ b/Sheaft.Web.Manage/Controllers/OrdersController.cs @@ -33,7 +33,7 @@ public OrdersController( } [HttpGet] - public async Task Index(CancellationToken token, OrderStatus? status = null, int page = 0, int take = 10) + public async Task Index(CancellationToken token, OrderStatus? status = null, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/PayinsController.cs b/Sheaft.Web.Manage/Controllers/PayinsController.cs index f9d145d40..7ce3a2d21 100644 --- a/Sheaft.Web.Manage/Controllers/PayinsController.cs +++ b/Sheaft.Web.Manage/Controllers/PayinsController.cs @@ -35,7 +35,7 @@ public PayinsController( } [HttpGet] - public async Task Index(CancellationToken token, TransactionStatus? status = null, int page = 0, int take = 10) + public async Task Index(CancellationToken token, TransactionStatus? status = null, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/PayoutsController.cs b/Sheaft.Web.Manage/Controllers/PayoutsController.cs index 80c458a81..6f4859f1f 100644 --- a/Sheaft.Web.Manage/Controllers/PayoutsController.cs +++ b/Sheaft.Web.Manage/Controllers/PayoutsController.cs @@ -35,7 +35,7 @@ public PayoutsController( } [HttpGet] - public async Task Index(CancellationToken token, TransactionStatus? status = null, int page = 0, int take = 10) + public async Task Index(CancellationToken token, TransactionStatus? status = null, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/ProducersController.cs b/Sheaft.Web.Manage/Controllers/ProducersController.cs index f0716680c..c14748b0e 100644 --- a/Sheaft.Web.Manage/Controllers/ProducersController.cs +++ b/Sheaft.Web.Manage/Controllers/ProducersController.cs @@ -35,7 +35,7 @@ public ProducersController( } [HttpGet] - public async Task Index(CancellationToken token, int page = 0, int take = 10) + public async Task Index(CancellationToken token, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/ProductsController.cs b/Sheaft.Web.Manage/Controllers/ProductsController.cs index b5fe6ee12..839290885 100644 --- a/Sheaft.Web.Manage/Controllers/ProductsController.cs +++ b/Sheaft.Web.Manage/Controllers/ProductsController.cs @@ -38,7 +38,7 @@ public ProductsController( } [HttpGet] - public async Task Index(CancellationToken token, int page = 0, int take = 10) + public async Task Index(CancellationToken token, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/PurchaseOrdersController.cs b/Sheaft.Web.Manage/Controllers/PurchaseOrdersController.cs index 01404ccf6..fb5f112ae 100644 --- a/Sheaft.Web.Manage/Controllers/PurchaseOrdersController.cs +++ b/Sheaft.Web.Manage/Controllers/PurchaseOrdersController.cs @@ -34,7 +34,7 @@ public PurchaseOrdersController( } [HttpGet] - public async Task Index(CancellationToken token, PurchaseOrderStatus? status = null, int page = 0, int take = 10) + public async Task Index(CancellationToken token, PurchaseOrderStatus? status = null, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/RegionsController.cs b/Sheaft.Web.Manage/Controllers/RegionsController.cs index b4de91f0e..1ab86c175 100644 --- a/Sheaft.Web.Manage/Controllers/RegionsController.cs +++ b/Sheaft.Web.Manage/Controllers/RegionsController.cs @@ -32,7 +32,7 @@ public RegionsController( } [HttpGet] - public async Task Index(CancellationToken token, int page = 0, int take = 10) + public async Task Index(CancellationToken token, int page = 0, int take = 20) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/ReturnablesController.cs b/Sheaft.Web.Manage/Controllers/ReturnablesController.cs index 553421fd2..3255dd6ab 100644 --- a/Sheaft.Web.Manage/Controllers/ReturnablesController.cs +++ b/Sheaft.Web.Manage/Controllers/ReturnablesController.cs @@ -34,7 +34,7 @@ public ReturnablesController( } [HttpGet] - public async Task Index(CancellationToken token, int page = 0, int take = 10) + public async Task Index(CancellationToken token, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/RewardsController.cs b/Sheaft.Web.Manage/Controllers/RewardsController.cs index 6b62c0cbd..8a9ecd8ac 100644 --- a/Sheaft.Web.Manage/Controllers/RewardsController.cs +++ b/Sheaft.Web.Manage/Controllers/RewardsController.cs @@ -35,7 +35,7 @@ public RewardsController( } [HttpGet] - public async Task Index(CancellationToken token, int page = 0, int take = 10) + public async Task Index(CancellationToken token, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/StoresController.cs b/Sheaft.Web.Manage/Controllers/StoresController.cs index 01c134034..80b2c7181 100644 --- a/Sheaft.Web.Manage/Controllers/StoresController.cs +++ b/Sheaft.Web.Manage/Controllers/StoresController.cs @@ -35,7 +35,7 @@ public StoresController( } [HttpGet] - public async Task Index(CancellationToken token, int page = 0, int take = 10) + public async Task Index(CancellationToken token, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/TagsController.cs b/Sheaft.Web.Manage/Controllers/TagsController.cs index a3a0491df..b4bd7c4b2 100644 --- a/Sheaft.Web.Manage/Controllers/TagsController.cs +++ b/Sheaft.Web.Manage/Controllers/TagsController.cs @@ -34,7 +34,7 @@ public TagsController( } [HttpGet] - public async Task Index(CancellationToken token, int page = 0, int take = 10) + public async Task Index(CancellationToken token, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Controllers/TransfersController.cs b/Sheaft.Web.Manage/Controllers/TransfersController.cs index 94c0f99cf..fde2fea55 100644 --- a/Sheaft.Web.Manage/Controllers/TransfersController.cs +++ b/Sheaft.Web.Manage/Controllers/TransfersController.cs @@ -35,7 +35,7 @@ public TransfersController( } [HttpGet] - public async Task Index(CancellationToken token, TransactionStatus? status = null, int page = 0, int take = 10) + public async Task Index(CancellationToken token, TransactionStatus? status = null, int page = 0, int take = 50) { if (page < 0) page = 0; diff --git a/Sheaft.Web.Manage/Views/BankAccounts/Create.cshtml b/Sheaft.Web.Manage/Views/BankAccounts/Create.cshtml index 2553d5a69..150b08455 100644 --- a/Sheaft.Web.Manage/Views/BankAccounts/Create.cshtml +++ b/Sheaft.Web.Manage/Views/BankAccounts/Create.cshtml @@ -8,7 +8,7 @@

New producer bank account


- @using (Html.BeginForm("CreateBankAccount", "Producers", FormMethod.Post)) + @using (Html.BeginForm("Create", "BankAccounts", FormMethod.Post)) { @Html.AntiForgeryToken() @Html.ValidationSummary(true, "", new { @class = "text-danger" }) diff --git a/Sheaft.Web.Manage/Views/BankAccounts/Update.cshtml b/Sheaft.Web.Manage/Views/BankAccounts/Edit.cshtml similarity index 95% rename from Sheaft.Web.Manage/Views/BankAccounts/Update.cshtml rename to Sheaft.Web.Manage/Views/BankAccounts/Edit.cshtml index 940561b5a..ab97cea58 100644 --- a/Sheaft.Web.Manage/Views/BankAccounts/Update.cshtml +++ b/Sheaft.Web.Manage/Views/BankAccounts/Edit.cshtml @@ -8,7 +8,7 @@

Update producer bank account


- @using (Html.BeginForm("UpdateBankAccount", "Producers", FormMethod.Post)) + @using (Html.BeginForm("Edit", "BankAccounts", FormMethod.Post)) { @Html.AntiForgeryToken() @Html.ValidationSummary(true, "", new { @class = "text-danger" })