public IActionResult Index() { var model = new GuitarBuilderViewModel { Guitar = new Guitar { Name = "My New Guitar" } }; return(View("Index", model)); }
public async Task <IActionResult> Index(GuitarBuilderViewModel model) { var adapter = new GuitarBuilderToGuitarAdapter(); model.Guitar = adapter.BuildGuitar(model); await TryUpdateModelAsync(model.Guitar); if (ModelState.IsValid) { return(RedirectToAction("OrderRecieved")); } return(View("Index", model)); }