コード例 #1
0
        //TODO Kolla om man blir directad till Getten av Create??
        public IActionResult CreateNewAuction(CreateAuctionViewModel newAuction)
        {
            if (ModelState.IsValid)
            {
                CreateAuctionViewModel viewModel = _businessService.SetCreateAuctionViewModel(newAuction);
                AuctionModel           model     = _businessService.MakeAuctionApiReady(newAuction);

                HttpResponseMessage response = _businessService.CreateNewAuction(model);

                if (response.IsSuccessStatusCode == true)
                {
                    return(RedirectToAction("Index", "Home", new { message = "Auction has successfully been created" }));
                }

                return(RedirectToAction("CreateNewAuction", "Admin", new { message = "Auction failed to be created" }));
            }

            return(View(newAuction));
        }