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;
}
///
/// گرفتن لیست معرف ها
///
///
///
[HttpGet]
public async Task>> Get(RepresentativeGetListSearchModel searchModel)
{
return await _representativeApplication.GetList(searchModel);
}
///
/// ایجاد معرف حقوقی
///
///
///
[HttpPost("legal")]
public ActionResult CreateLegal([FromBody] CreateLegalRepresentative command)
{
return _representativeApplication.CreateLegal(command);
}
///
/// ایجاد معرف حقیقی
///
///
///
[HttpPost("real")]
public ActionResult CreateReal([FromBody] CreateRealRepresentative command)
{
return _representativeApplication.CreateReal(command);
}
///
/// گرفتن جزئیات معرف
///
///
///
[HttpGet("{id}")]
public ActionResult GetDetails(long id)
{
return _representativeApplication.GetDetails(id);
}
///
/// ویرایش معرف حقوقی
///
///
///
[HttpPut("Legal")]
public ActionResult EditLegal([FromBody] EditLegalRepresentative command)
{
return _representativeApplication.EditLegal(command);
}
///
/// ویرایش معرف حقیقی
///
///
///
[HttpPut("Real")]
public ActionResult EditReal([FromBody] EditRealRepresentative command)
{
return _representativeApplication.EditReal(command);
}
///
/// گرفتن لیست طرف حساب ها با آیدی معرف
///
///
///
[HttpGet("contracting_parties/{id}")]
public ActionResult> GetContractingParties(long id)
{
return _representativeApplication.GetContractingParties(id);
}
///
/// حذف معرف
///
///
///
[HttpDelete]
public ActionResult Delete(long id)
{
return _representativeApplication.DeleteRepresentative(id);
}
///
/// فعال کردن معرف
///
///
///
[HttpPost("active/{id}")]
public ActionResult Active(long id)
{
return _representativeApplication.Active(id);
}
///
/// غیرفعال کردن معرف
///
///
///
[HttpPost("deactivate/{id}")]
public ActionResult DeActive(long id)
{
return _representativeApplication.DeActive(id);
}
///
/// طرف حسابی دارد یا ندارد
///
///
///
[HttpGet("has_any_contracting_party")]
public ActionResult HasAnyContractingParty(long id)
{
return _representativeApplication.HasAnyContractingParty(id);
}
///
/// سلکت لیست معرف برای سرچ
///
///
[HttpGet("select_list")]
public async Task> GetSelectList()
{
return await _representativeApplication.GetSelectList();
}
}