fix
This commit is contained in:
@@ -4,8 +4,10 @@ using Core.Extensions;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Models.Account;
|
||||
using MyOffice.Data.Models.Accounts;
|
||||
using MyOffice.Web.Models.AccountMotion;
|
||||
using Services.Account;
|
||||
using Services.Account.Domain;
|
||||
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
@@ -43,8 +45,18 @@ public class AccountController : BaseApiController
|
||||
[HttpPost("~/api/accounts/{id}/motions")]
|
||||
public object AccountsMotionsPost(string id, AccountMotionRequest accountMotion)
|
||||
{
|
||||
var list = _accountService.GetByCategoryDetailed(UserId, category!.AsGuid());
|
||||
var exec = _accountService.AccountMotionAdd(UserId, id.AsGuid(), accountMotion.FromModel());
|
||||
switch (exec.Status)
|
||||
{
|
||||
case AccountMotionAddResult.account_not_found:
|
||||
return ProblemBadRequest("Account failed.");
|
||||
case AccountMotionAddResult.failure:
|
||||
return ProblemBadRequest("Adding motion failed.");
|
||||
case AccountMotionAddResult.success:
|
||||
return exec.Result!;
|
||||
|
||||
return list.Select(x => x.ToModel());
|
||||
default:
|
||||
throw new NotSupportedException(exec.Status.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user