public async Task<BillViewModel> GetDetail(int billId) { var bill = await _orderRepository.FindSingle(x => x.Id == billId, c => c.BillDetails); var billVm = new BillViewModel().Map(bill); billVm.BillDetails = await GetBillDetails(billId); return billVm; }
public BillViewModel GetDetail(int billId) { var bill = _orderRepository.FindSingle(x => x.Id == billId); var billVm = Mapper.Map <Bill, BillViewModel>(bill); billVm.BillDetails = _orderDetailRepository.FindAll(x => x.BillId == billId).ProjectTo <BillDetailViewModel>().ToList(); return(billVm); }
public BillViewModel GetWithDetails(int orderId) { Bill bill = _orderRepository.FindSingle(x => x.Id == orderId); BillViewModel billViewModel = Mapper.Map <Bill, BillViewModel>(bill); List <BillDetailViewModel> billDetailViewModels = _orderDetailRepository.FindAll(x => x.BillId == orderId).ProjectTo <BillDetailViewModel>().ToList(); billViewModel.BillDetails = billDetailViewModels; return(billViewModel); }
public BillViewModel GetDetail(int billId) { var bill = _orderRepository.FindSingle(x => x.Id == billId); var billVm = _mapper.Map <BillViewModel>(bill); var billDetailVm = _orderDetailRepository.FindAll(x => x.BillId == billId).ProjectTo <BillDetailViewModel>(_mapper.ConfigurationProvider).ToList(); billVm.BillDetails = billDetailVm; return(billVm); }
public BillViewModel GetByBillId(int id) { var bill = _billRepository.FindSingle(x => x.Id == id, x => x.BillDetails); return(Mapper.Map <Bill, BillViewModel>(bill)); }