// GET: AuctionCreate /* [HttpGet] * public ActionResult AuctionCreate() * { * return View(); * }*/ // [HttpPost] public ActionResult AuctionCreate(AuctionCreate auctionCreate) { DatabaseController databaseController = new DatabaseController(); databaseController.AuctionCreationOnDatabase(auctionCreate); return(View()); }
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); } }
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()); }
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)); }