Beispiel #1
0
        public ActionResult Create([Bind(Include = "Id,Account,ProductsId,MakeAnOffer,OfferBitPrice")] SetBid SetBid)
        {
            if (ModelState.IsValid)
            {
                var product = db.Products.Where(p => p.Id == SetBid.ProductsId).FirstOrDefault();
                product.LastBidPrice    = SetBid.OfferBitPrice;
                db.Entry(product).State = EntityState.Modified;
                db.SaveChanges();

                var userid = User.Identity.GetUserId();
                SetBid.ApplicationUserId = userid;

                db.SetBids.Add(SetBid);
                db.SaveChanges();
                return(View("SuccessOffer"));
            }
            var results = GetAccounts.Get();
            var ktima   = GetCurrentInfo.Get();

            ViewBag.ktimaInfo  = ktima;
            ViewBag.selectedid = SetBid.ProductsId;
            ViewBag.AccountNo  = new SelectList(results, "AccountId", "AccountId", SetBid.Account);
            ViewBag.ProductsId = new SelectList(db.Products, "Id", "ItemName", SetBid.ProductsId);
            return(View(SetBid));
        }
Beispiel #2
0
        // GET: SetBids/Create
        public ActionResult Create(int id)
        {
            ViewBag.ProductsId = new SelectList(db.Products.Where(o => o.Id == id), "Id", "ItemName", id);
            ViewBag.Product    = db.Products.Where(o => o.Id == id).FirstOrDefault();
            var results = GetAccounts.Get();
            List <AccountsResponse> accountid = new List <AccountsResponse>();
            var ktima = GetCurrentInfo.Get();

            ViewBag.ktimaInfo  = ktima;
            ViewBag.selectedid = id;
            foreach (var item in results)
            {
                AccountsResponse accid = new AccountsResponse();
                accid.AccountId = item.AccountId;
                accountid.Add(accid);
            }

            ViewBag.AccountNo = new SelectList(accountid, "AccountId", "AccountId");
            return(View());
        }