Beispiel #1
0
        public ActionResult Bid_Read([DataSourceRequest] DataSourceRequest request, int id = 0)
        {
            var bids          = id == 0?_bidService.Get(m => m.StatusID == (int)BidStatus.Open).OrderByDescending(m => m.BidID).ToList():_bidService.Get(m => m.StatusID == id).ToList();
            var bidsToDisplay = GetBids(bids).ToList();

            return(Json(bidsToDisplay.ToDataSourceResult(request)));
        }
        public BidDTO Get(Guid userItemId, string bidderId)
        {
            var bid = _bidService.Get(userItemId, bidderId);

            if (bid == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            return(bid);
        }
Beispiel #3
0
        public void Edit_Bid_Test()
        {
            List <Bid> expected = new List <Bid>();
            {
                new Bid()
                {
                    BidID = 1, BidNumber = "PP452", StartDate = new DateTime(2012 / 10 / 10), EndDate = new DateTime(2013 / 12 / 11), OpeningDate = new DateTime(2013 / 02 / 03), StatusID = 1
                };
                new Bid()
                {
                    BidID = 2, BidNumber = "AAA123", StartDate = new DateTime(2012 / 10 / 10), EndDate = new DateTime(2013 / 12 / 11), OpeningDate = new DateTime(2012 / 12 / 11), StatusID = 2
                };
            }

            List <Bid> actual = (List <Bid>)MockBidService.Get(m => m.BidID == 1);

            Assert.AreEqual(actual, expected);

            foreach (var bidExpected in expected)
            {
                Assert.IsTrue(actual.Contains(actual.Find(r => r.BidID == bidExpected.BidID)));
            }
            Assert.AreEqual(expected, actual);
        }