public async Task <int> Create(GarmentDebiturBalanceViewModel viewModel) { viewModel.buyerAgent = viewModel.buyerAgent ?? new BuyerAgent(); GarmentDebiturBalanceModel model = new GarmentDebiturBalanceModel(viewModel.balanceDate.GetValueOrDefault(), viewModel.buyerAgent.Id, viewModel.buyerAgent.Code, viewModel.buyerAgent.Name, viewModel.balanceAmount, viewModel.balanceAmountIDR); return(await _repository.InsertAsync(model)); }