public async Task <IActionResult> Create(GoncertCreateInputModel input) { var venues = await this.venuesService.GetAllAsync <VenuesDropDownViewModel>(); if (!this.ModelState.IsValid) { input.Venues = venues; return(this.View(input)); } try { var id = await this.concertsService .CreateAsync(input.Name, input.ImgUrl, input.Date, input.TicketUrl, input.VenueId); this.TempData["Success"] = CreateSuccessMessage; return(this.Redirect("/Concerts/Details/" + id)); } catch (Exception e) { this.TempData["Error"] = e.Message; input.Venues = venues; return(this.View(input)); } }
public async Task <IActionResult> Create() { var venues = await this.venuesService.GetAllAsync <VenuesDropDownViewModel>(); var viewModel = new GoncertCreateInputModel { Venues = venues, }; return(this.View(viewModel)); }