public List <DTO_Offer> GetOffersByPartDesc(DTO_Part p)
        {
            //string partDesc = p.partDesc;
            DB_111206_scrapEntities db = new DB_111206_scrapEntities();
            var listOffers             = db.Offers.ToList();
            var matches = listOffers.Where(x => x.Part.partDesc.Contains(p.Description)).ToList();

            List <DTO_Offer> offers = new List <DTO_Offer>();

            foreach (var offer in matches)
            {
                var o = new DTO_Offer
                {
                    Id = offer.offerID,

                    /* Parts = offer.partsID,// partsID),
                     * Seller = Convert.ToInt32(offer.sellerID),
                     */
                    Price = Convert.ToInt32(offer.price),
                    Ostat = Convert.ToInt32(offer.ostat),
                    DT    = offer.offerDate
                };
                offers.Add(o);
            }


            return(offers);
        }
        public List <DTO_Offer> GetOffers()
        {
            DB_111206_scrapEntities db           = new DB_111206_scrapEntities();
            List <DTO_Offer>        returnOffers = new List <DTO_Offer>();
            var offersTable = db.Offers.ToList();

            foreach (var o in offersTable)
            {
                DTO_Offer tempO = new DTO_Offer
                {
                    DT       = o.offerDate,
                    Id       = o.offerID,
                    Ostat    = Convert.ToInt32(o.ostat),
                    PartId   = Convert.ToInt32(o.partsID),
                    Price    = Convert.ToDouble(o.price),
                    SellerId = Convert.ToInt32(o.sellerID)
                };
                returnOffers.Add(tempO);
            }
            return(returnOffers);
        }
        public List <DTO_Offer> GetOffersByUser(DTO_User user)
        {
            List <DTO_Offer> offers = new List <DTO_Offer>();

            using (DB_111206_scrapEntities db = new DB_111206_scrapEntities())
            {
                var match = db.Users.Where(u => u.email == user.Email && u.pwd == user.Password).FirstOrDefault();
                if (match != null)
                {
                    var offers_ = match.Offers.ToList();
                    foreach (var i in offers_)
                    {
                        DTO_Offer bid = new DTO_Offer();
                        i.offerID   = bid.Id;
                        i.offerDate = bid.DT;
                        i.price     = (decimal)bid.Price;
                        offers.Add(bid);
                    }
                }
            }

            return(offers);
        }