Untitled
unknown
plain_text
a year ago
1.5 kB
9
Indexable
Never
misal dto fenya { "EmpName": "user1", "EmpNo" : "001", "EmpAddress" : "jl x", "EmpAddressRt": "01", "EmpAddressRw": "02", "EmpGradeLvl" : "sales", } --------------------------------------------------------- misal type dto benya : "RefEmpdto"(core) : { "EmpName" "EmpNo", "EmpAddress", "EmpAddressRt", "EmpAddressRw" } "RefEmpXdto"(x) inherit "RefEmpdto": { "EmpGradeLvl" } --------------------------------------------------------- misal contoh APInya : [ApiController] [Route("api/[controller]")] public class YourController : ControllerBase { private readonly IYourService isvc; public YourController(IYourService isvc) { isvc = isvc; } public IActionResult X(RefEmpXdto dto) { //misal di method ini ada kebutuhan untuk panggil svc core dimana dy butuh parameter core (RefEmpdto) //kondisi saat ini, disni perlu ada effort untuk mapping ulang dto core nya RefEmpdto refEmpDto = new RefEmpdto { EmpName = dto.EmpName, EmpNo = dto.EmpNo, EmpAddress = dto.EmpAddress, EmpAddressRt = dto.EmpAddressRt, EmpAddressRw = dto.EmpAddressRw }; // Panggil service dengan objek RefEmpdto yang telah diinisialisasi di baris 48 isvc.serviceCore(refEmpDto); return Ok(); } }