protected virtual async Task Create(CreateOrEditQuotationDetailDto input) { var quotationDetail = ObjectMapper.Map <QuotationDetail>(input); if (AbpSession.TenantId != null) { quotationDetail.TenantId = (int?)AbpSession.TenantId; } await _quotationDetailRepository.InsertAsync(quotationDetail); }
public async Task CreateOrEdit(CreateOrEditQuotationDetailDto input) { decimal discountPrice = 0, taxPrice = 0; decimal markUp = input.MarkUp; decimal unitPrice = input.UnitPrice; decimal quantity = input.Quantity; decimal tax = input.Tax; decimal discount = input.Discount; decimal costPrice = unitPrice * quantity; if (markUp > 0) { costPrice += costPrice * (markUp / 100); } if (discount > 0) { discountPrice = costPrice * (discount / 100); } if (tax > 0) { taxPrice = (costPrice - discountPrice) * (tax / 100); } input.Cost = costPrice; input.Charge = (costPrice - discountPrice) + taxPrice; if (input.Id == null) { await Create(input); } else { await Update(input); } }
protected virtual async Task Update(CreateOrEditQuotationDetailDto input) { var quotationDetail = await _quotationDetailRepository.FirstOrDefaultAsync((int)input.Id); ObjectMapper.Map(input, quotationDetail); }