151 lines
4.4 KiB
C#
151 lines
4.4 KiB
C#
using _0_Framework.Application;
|
||
using CompanyManagment.App.Contracts.PersonalContractingParty;
|
||
using CompanyManagment.App.Contracts.Representative;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
using ServiceHost.BaseControllers;
|
||
|
||
namespace ServiceHost.Areas.Admin.Controllers;
|
||
|
||
public class RepresentativeController : AdminBaseController
|
||
{
|
||
private readonly IRepresentativeApplication _representativeApplication;
|
||
|
||
public RepresentativeController(IRepresentativeApplication representativeApplication)
|
||
{
|
||
_representativeApplication = representativeApplication;
|
||
}
|
||
|
||
/// <summary>
|
||
/// گرفتن لیست معرف ها
|
||
/// </summary>
|
||
/// <param name="searchModel"></param>
|
||
/// <returns></returns>
|
||
[HttpGet]
|
||
public async Task<ActionResult<List<RepresentativeGetListViewModel>>> Get(RepresentativeGetListSearchModel searchModel)
|
||
{
|
||
return await _representativeApplication.GetList(searchModel);
|
||
}
|
||
|
||
/// <summary>
|
||
/// ایجاد معرف حقوقی
|
||
/// </summary>
|
||
/// <param name="command"></param>
|
||
/// <returns></returns>
|
||
[HttpPost("legal")]
|
||
public ActionResult<OperationResult> CreateLegal([FromBody] CreateLegalRepresentative command)
|
||
{
|
||
return _representativeApplication.CreateLegal(command);
|
||
}
|
||
|
||
/// <summary>
|
||
/// ایجاد معرف حقیقی
|
||
/// </summary>
|
||
/// <param name="command"></param>
|
||
/// <returns></returns>
|
||
[HttpPost("real")]
|
||
public ActionResult<OperationResult> CreateReal([FromBody] CreateRealRepresentative command)
|
||
{
|
||
return _representativeApplication.CreateReal(command);
|
||
}
|
||
|
||
/// <summary>
|
||
/// گرفتن جزئیات معرف
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{id}")]
|
||
public ActionResult<EditRepresentative> GetDetails(long id)
|
||
{
|
||
return _representativeApplication.GetDetails(id);
|
||
}
|
||
|
||
/// <summary>
|
||
/// ویرایش معرف حقوقی
|
||
/// </summary>
|
||
/// <param name="command"></param>
|
||
/// <returns></returns>
|
||
[HttpPut("Legal")]
|
||
public ActionResult<OperationResult> EditLegal([FromBody] EditLegalRepresentative command)
|
||
{
|
||
return _representativeApplication.EditLegal(command);
|
||
}
|
||
|
||
/// <summary>
|
||
/// ویرایش معرف حقیقی
|
||
/// </summary>
|
||
/// <param name="command"></param>
|
||
/// <returns></returns>
|
||
[HttpPut("Real")]
|
||
public ActionResult<OperationResult> EditReal([FromBody] EditRealRepresentative command)
|
||
{
|
||
return _representativeApplication.EditReal(command);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// گرفتن لیست طرف حساب ها با آیدی معرف
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("contracting_parties/{id}")]
|
||
public ActionResult<List<PersonalContractingPartyViewModel>> GetContractingParties(long id)
|
||
{
|
||
return _representativeApplication.GetContractingParties(id);
|
||
}
|
||
|
||
/// <summary>
|
||
/// حذف معرف
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
[HttpDelete]
|
||
public ActionResult<OperationResult> Delete(long id)
|
||
{
|
||
return _representativeApplication.DeleteRepresentative(id);
|
||
}
|
||
|
||
/// <summary>
|
||
/// فعال کردن معرف
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
[HttpPost("active/{id}")]
|
||
public ActionResult<OperationResult> Active(long id)
|
||
{
|
||
return _representativeApplication.Active(id);
|
||
}
|
||
|
||
/// <summary>
|
||
/// غیرفعال کردن معرف
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
[HttpPost("deactivate/{id}")]
|
||
public ActionResult<OperationResult> DeActive(long id)
|
||
{
|
||
return _representativeApplication.DeActive(id);
|
||
}
|
||
|
||
/// <summary>
|
||
/// طرف حسابی دارد یا ندارد
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("has_any_contracting_party")]
|
||
public ActionResult<bool> HasAnyContractingParty(long id)
|
||
{
|
||
return _representativeApplication.HasAnyContractingParty(id);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// سلکت لیست معرف برای سرچ
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("select_list")]
|
||
public async Task<List<GetSelectListRepresentativeViewModel>> GetSelectList()
|
||
{
|
||
return await _representativeApplication.GetSelectList();
|
||
}
|
||
|
||
} |