Пример #1
0
        public JsonResult CreateBid(BidModel bid)
        {
            try
            {
                LotModel lot = LotModel.GetLotById(bid.LotId).First();
                if (lot.DeadLine < DateTime.Now)
                {
                    return(Json("@Resource.LotDayPassed", JsonRequestBehavior.AllowGet));
                }

                if (bid.Amount < lot.CurrentBid + lot.Step)
                {
                    return(Json("Amount is low than the current bid's", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    bid.UserId = User.Identity.GetUserId();
                    bid.Save();
                    return(Json("Bid made successfully. ", JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        public ActionResult Index()
        {
            var top = LotModel.GetTopLots(1);

            ViewBag.Top = top;
            var secondTop = LotModel.GetTopLots(2);

            ViewBag.SecondTop = secondTop;
            var thirdTop = LotModel.GetTopLots(3);

            ViewBag.ThirdTop = thirdTop;
            var lots = LotModel.GetLotById(null);

            try{
                lots.RemoveAll(l => l.Id == top.Id);
                lots.RemoveAll(l => l.Id == secondTop.Id);
                lots.RemoveAll(l => l.Id == thirdTop.Id);
            }
            catch {
            }
            ViewBag.Categories = CategoryModel.GetCategoryById(null);
            if (Request.IsAuthenticated)
            {
                ViewBag.WinnedBids = BidModel.GetWinnerBids(User.Identity.GetUserId());
            }

            return(View(lots));
        }
Пример #3
0
        public ActionResult EditLot(int id)
        {
            LotModel lot = LotModel.GetLotById(id).First();

            ViewBag.Partners   = Partner.GetPartner(null, null);
            ViewBag.Categories = CategoryModel.GetCategoryById(null);
            return(View("CreateLot", lot));
        }
Пример #4
0
        public ActionResult Item(int id)
        {
            var lot = LotModel.GetLotById(id).First();

            return(View(lot));
        }