using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using XYY.Core.Standard.Mvc;
using XYY.Model.Standard.Finance;
using XYY.Service.Standard.Finance;

namespace XYY.Api.Finance.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class CollectionAccountController : ApiControllerBase
    {
        IFinanceCollectionAccountService _financeCollectionAccountService;

        public CollectionAccountController(IFinanceCollectionAccountService financeCollectionAccountService)
        {
            _financeCollectionAccountService = financeCollectionAccountService;
        }

        [HttpPost]
        public async Task<IActionResult> Save(Finance_Collection_Account account)
        {
            int Id = await _financeCollectionAccountService.Save(account);
            return Ok(Id);
        }

        [HttpPost]
        public async Task<IActionResult> Delete(Finance_Collection_Account account)
        {
            await _financeCollectionAccountService.Delete(account);
            return Ok();
        }


        public async Task<IActionResult> GetList()
        {
            return Ok(await _financeCollectionAccountService.GetList());
        }
    }
}
