Up to 2023-10-22

chap4_mvc5
jason-zhu 2023-10-22 12:15:29 +11:00
parent 4021889c65
commit 2b2f60b4eb
4 changed files with 30 additions and 8 deletions

View File

@ -1,16 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc;
using MvcMusicStore.Data;
namespace MvcMusicStore.Controllers
{
public class HomeController : Controller
{
public String Index()
public ActionResult Index()
{
return "I like cake!";
return View();
}
public ActionResult About()
@ -26,5 +23,10 @@ namespace MvcMusicStore.Controllers
return View();
}
//public ActionResult Search(string q)
//{
// var albums =
//}
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MvcMusicStore.Models
{
public class AlbumEditViewModel
{
public Album AlbumToEdit { get; set; }
public System.Web.Mvc.SelectList Genres { get; set; }
public System.Web.Mvc.SelectList Artists { get; set; }
}
}

View File

@ -134,6 +134,7 @@
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Models\Album.cs" />
<Compile Include="Models\AlbumEditViewModel.cs" />
<Compile Include="Models\Artist.cs" />
<Compile Include="Models\Genre.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />

View File

@ -29,3 +29,8 @@
<p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301867">Learn more &raquo;</a></p>
</div>
</div>
<form action="/Home/Search" method="get">
<input type="text" name="q" />
<input type="submit" value="Search" />
</form>