Skip to content

Commit

Permalink
Update - Mise à jour du site de manage
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmugnier committed Nov 30, 2020
1 parent b004d8c commit c005726
Show file tree
Hide file tree
Showing 25 changed files with 57 additions and 37 deletions.
9 changes: 6 additions & 3 deletions Sheaft.Application.Mappers/TagProfile.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
using AutoMapper;
using Sheaft.Domain.Models;
using Sheaft.Application.Models;
using System;
using Sheaft.Core.Extensions;
using Sheaft.Core.Models;

namespace Sheaft.Application.Mappers
{
public class TagProfile : Profile
{
public TagProfile()
{
CreateMap<Tag, TagDto>();
CreateMap<Tag, TagViewModel>();
CreateMap<Tag, TagDto>()
.ForMember(d => d.Picture, opt => opt.MapFrom(r => CoreProductExtensions.GetPictureUrl(r.Picture, PictureSize.LARGE)));
CreateMap<Tag, TagViewModel>()
.ForMember(d => d.Picture, opt => opt.MapFrom(r => CoreProductExtensions.GetPictureUrl(r.Picture, PictureSize.LARGE)));
}
}
}
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/AgreementsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public AgreementsController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, AgreementStatus? status = null, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, AgreementStatus? status = null, int page = 0, int take = 25)
{
if (page < 0)
page = 0;
Expand Down
39 changes: 28 additions & 11 deletions Sheaft.Web.Manage/Controllers/BankAccountsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ public BankAccountsController(
_logger = logger;
}


[HttpGet]
public async Task<IActionResult> CreateBankAccount(Guid userId, CancellationToken token)
public async Task<IActionResult> Create(Guid userId, CancellationToken token)
{
var entity = await _context.Users.OfType<Business>()
.AsNoTracking()
Expand All @@ -55,7 +54,7 @@ public async Task<IActionResult> CreateBankAccount(Guid userId, CancellationToke

[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> CreateBankAccount(BankAccountViewModel model, CancellationToken token)
public async Task<IActionResult> Create(BankAccountViewModel model, CancellationToken token)
{
var result = await _mediatr.Process(new CreateBankAccountCommand(await GetRequestUser(token))
{
Expand All @@ -74,26 +73,44 @@ public async Task<IActionResult> 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<IActionResult> UpdateBankAccount(Guid bankAccountId, CancellationToken token)
public async Task<IActionResult> Edit(Guid id, CancellationToken token)
{
var entity = await _context.BankAccounts.Get(c => c.Id == bankAccountId)
.ProjectTo<BankAccountViewModel>(_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<IActionResult> UpdateBankAccount(BankAccountViewModel model, CancellationToken token)
public async Task<IActionResult> Edit(BankAccountViewModel model, CancellationToken token)
{
var result = await _mediatr.Process(new UpdateBankAccountCommand(await GetRequestUser(token))
{
Expand All @@ -112,7 +129,7 @@ public async Task<IActionResult> UpdateBankAccount(BankAccountViewModel model, C
return View(model);
}

return RedirectToAction("Edit", new { id = model.OwnerId });
return RedirectToAction("Edit", new { id = model.Id });
}
}
}
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/ConsumersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public ConsumersController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/DeclarationsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public DeclarationsController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 25)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/DeliveryModesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public DeliveryModesController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/DepartmentsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public DepartmentsController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 200)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/DonationsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public DonationsController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, TransactionStatus? status = null, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, TransactionStatus? status = null, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/JobsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public JobsController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, ProcessStatus? status = null, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, ProcessStatus? status = null, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/LegalsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public LegalsController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, LegalKind? kind = null, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, LegalKind? kind = null, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/LevelsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public LevelsController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/OrdersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public OrdersController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, OrderStatus? status = null, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, OrderStatus? status = null, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/PayinsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public PayinsController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, TransactionStatus? status = null, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, TransactionStatus? status = null, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/PayoutsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public PayoutsController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, TransactionStatus? status = null, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, TransactionStatus? status = null, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/ProducersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public ProducersController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/ProductsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public ProductsController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/PurchaseOrdersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public PurchaseOrdersController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, PurchaseOrderStatus? status = null, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, PurchaseOrderStatus? status = null, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/RegionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public RegionsController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 20)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/ReturnablesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public ReturnablesController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/RewardsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public RewardsController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/StoresController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public StoresController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/TagsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public TagsController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Controllers/TransfersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public TransfersController(
}

[HttpGet]
public async Task<IActionResult> Index(CancellationToken token, TransactionStatus? status = null, int page = 0, int take = 10)
public async Task<IActionResult> Index(CancellationToken token, TransactionStatus? status = null, int page = 0, int take = 50)
{
if (page < 0)
page = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sheaft.Web.Manage/Views/BankAccounts/Create.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<h2 class="display-4">New producer bank account</h2>
<br />

@using (Html.BeginForm("CreateBankAccount", "Producers", FormMethod.Post))
@using (Html.BeginForm("Create", "BankAccounts", FormMethod.Post))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<h2 class="display-4">Update producer bank account</h2>
<br />

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

0 comments on commit c005726

Please sign in to comment.