public decimal?GetTotalEarnMoneyByTransactionId(int id) { Transaction ts = _transactionRepository.GetSingleByID(id); Model.Models.Service s = _serviceRepository.GetSingleByID(ts.ServiceId); float? vat = s.VAT; decimal?earnTotal = 0; var listTransactionDetail = _transactionDetailRepository.GetMulti(x => x.TransactionId == id).ToList(); foreach (var item in listTransactionDetail) { decimal?percent = _propertyServiceRepository.GetSingleByID(item.PropertyServiceId).Percent; if (vat > 0 && vat != null) { earnTotal = earnTotal + percent * item.Money / Convert.ToDecimal(vat); } else { earnTotal = earnTotal + percent * item.Money; } } int?quantity = _transactionRepository.GetSingleByID(id).Quantity; return(earnTotal); }
public PropertyService GetById(int id) { return(_propertyServiceRepository.GetSingleByID(id)); }