public async Task <Bill> GetBillByID(long id) { var param = new DynamicParameters(); param.Add("@ID", id); var mapper = new BillMapper(); return((await SqlMapper.QueryAsync(_unitOfWork.Connection, "GetBillByID", new[] { typeof(Bill), typeof(BillLineItem), typeof(Payment) }, obj => { return mapper.Map(obj[0] as Bill, obj[1] as BillLineItem, obj[2] as Payment); }, param, splitOn: "ID,LineItemID,PaymentID", commandType: CommandType.StoredProcedure, transaction: _unitOfWork.Transaction)).FirstOrDefault()); }
public async Task <IList <Bill> > Query(BillFilter filter) { var param = new DynamicParameters(); param.Add("ID", filter.ID); param.Add("RequestID", filter.RequestID); param.Add("RefNo", filter.RefNo); param.Add("RefID", filter.RefID); param.Add("CustomerName", filter.CustomerName); param.Add("Status", filter.Status); param.Add("From", filter.From); param.Add("To", filter.To); param.Add("InvoiceNo", filter.InvoiceNo); param.Add("Type", filter.Type); var mapper = new BillMapper(); return((await SqlMapper.QueryAsync(_unitOfWork.Connection, "SelectBill", new[] { typeof(Bill), typeof(BillLineItem), typeof(Payment) }, obj => { return mapper.Map(obj[0] as Bill, obj[1] as BillLineItem, obj[2] as Payment); }, param, splitOn: "ID,LineItemID,PaymentID", commandType: CommandType.StoredProcedure, transaction: _unitOfWork.Transaction)).Distinct().ToList()); }
public async Task <IEnumerable <Bill> > GetUserBills(Guid userId) { return((await RepoDbSet.AsQueryable().Where(b => b.AppUserId.Equals(userId)).ToListAsync()).Select(domainBill => BillMapper.Map(domainBill))); }
public Bill AddNewBill(DAL.App.DTO.Bill bill) { var domain = RepoDbSet.AddAsync(BillMapper.MapToDomain(bill)).Result.Entity; return(BillMapper.Map((domain))); }