public void Delete(long Id,
                    ref IAuctionTransaction trans)
 {
     using(var records = new BidderCollection())
     {
         var filter = new PredicateExpression(BidderFields.Id == Id);
         if(trans != null)
         {
             trans.Add(records);
         }
         records.DeleteMulti(filter);
     }
 }
        public IList<Auction.Domain.Bidder> GetByEvent(long eventId,
                                ref IAuctionTransaction trans)
        {
            using (var records = new BidderCollection())
            {
                var filter = new PredicateExpression(BidderFields.EventId == eventId);

                if (trans != null)
                {
                    trans.Add(records);
                }
                records.GetMulti(filter, 0);
                return records.ToList().Select(b => new Bidder() { Id = b.Id, Number = b.Number, Name = b.Name, EventId = eventId, Phone = b.Phone }).ToList();
            }
        }
        public Auction.Domain.Bidder Get(long Id, ref IAuctionTransaction trans)
        {
            using (var records = new BidderCollection())
            {
                var filter = new PredicateExpression(BidderFields.Id == Id);

                if (trans != null)
                {
                    trans.Add(records);
                }
                records.GetMulti(filter, 1);
                var b = records.ToList().FirstOrDefault();
                return new Bidder() { Id = b.Id, Number = b.Number, Name = b.Name, EventId = b.EventId, Phone = b.Phone };
            }
        }
 public void Update(ref Bidder bidder,
                    ref IAuctionTransaction trans)
 {
     using (var records = new BidderCollection())
     {
         var filter = new PredicateExpression(BidderFields.Id == bidder.Id);
         var b = new BidderEntity
                     {
                         Number = bidder.Number,
                         Name = bidder.Name,
                         Phone = bidder.Phone,
                         EventId = bidder.EventId,
                         CreatedBy = bidder.CreatedBy
                     };
         if (trans != null)
         {
             trans.Add(records);
         }
         records.UpdateMulti(b, filter);
     }
 }