// GET: AuctionCreate

        /* [HttpGet]
         * public ActionResult AuctionCreate()
         * {
         *   return View();
         * }*/
        // [HttpPost]
        public ActionResult AuctionCreate(AuctionCreate auctionCreate)
        {
            DatabaseController databaseController = new DatabaseController();

            databaseController.AuctionCreationOnDatabase(auctionCreate);
            return(View());
        }
Ejemplo n.º 2
0
        public bool CreateAuction(AuctionCreate model)
        {
            var entity =
                new Auction()
            {
                EmployeeId      = _userId,
                AuctionName     = model.AuctionName,
                AuctionDate     = model.AuctionDate,
                AuctionLocation = model.AuctionLocation
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Auctions.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
Ejemplo n.º 3
0
        public ActionResult AuctionCreationOnDatabase(AuctionCreate auctionCreate)
        {
            var auctionCreateData = auctionCreate;

            //  PushResponse pushResponse = client.Push("Register/", registerData);
            // registerData.RegisterID = pushResponse.Result.name;
            if (client == null)
            {
                getClient();
            }


            var getAuctionnumberResponse = client.Get(@"Auctionnumber");
            var Auctionnumber            = int.Parse(getAuctionnumberResponse.ResultAs <string>());

            SetResponse setAuctionnumberResponse = client.Set(@"Auctionnumber", ++Auctionnumber);
            SetResponse setResponse = client.Set(@"AuctionCreate/" + auctionCreate.AuctionId, auctionCreate);

            return(View());
        }
Ejemplo n.º 4
0
        public ActionResult Create(AuctionCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = CreateAuctionService();

            if (service.CreateAuction(model))
            {
                TempData["SaveResult"] = "The Auction has been added.";
                return(RedirectToAction("Index"));
            }
            ;

            ModelState.AddModelError("", "The Auction could not be created.");

            return(View(model));
        }