public ActionResult Create(Auction auction)
        {
            if (ModelState.IsValid)
            {
                var db = new EbuyDataContext();
                db.Auctions.Add(auction);
                db.SaveChanges();

                return RedirectToAction("Details", new { id = auction.Id });
            }

            return View(auction);
        }
Esempio n. 2
0
        // GET: /Details/
        public ActionResult Details()
        {
            var auction = new Auction()
            {
                Title = "Brand new Widge 2.0",
                Description = "This is brand new verison 2.0 Widget!",
                StartPrice = 1.00m,
                CurrentPrice = 13.40m,
                EndTime = DateTime.Now
            };

            return View(auction);
        }
Esempio n. 3
0
 //
 // GET: /Auctions/Details/5
 public ActionResult Details(long id = 0)
 {
     var auction = new Ebuy.Website.Models.Auction
     {
         Id = id,
         Title = "Brand new Widget 2.0",
         Description = "This is a brand new version 2.0 Widget!",
         StartPrice = 1.00m,
         CurrentPrice = 13.40m,
         StartTime = DateTime.Parse("6-15-2012 12:34 PM"),
         EndTime = DateTime.Parse("6-23-2012 12:34 PM"),
     };
     return View(auction);
 }
Esempio n. 4
0
        public ActionResult Create(Auction auction)
        {
            if (auction.EndTime <= DateTime.Now.AddDays(1))
            {
                ModelState.AddModelError("EndTime",
                    "Action must be at least one day long");
            }

            if (ModelState.IsValid) {
                var db = new EBuyDataContext();
                db.Auctions.Add(auction);
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(auction);
        }
 public static string Auction(this UrlHelper helper, Auction auction)
 {
     return helper.Action("Auction", "Auctions", new { key = auction.Key, title = auction.Title });
 }
Esempio n. 6
0
 public ActionResult Create(Auction auction)
 {
     return View(auction);
 }