public void Find_ReturnsCorrectCD_CD() { CD newCD1 = new CD("title1"); CD newCD2 = new CD("title2"); CD result = CD.Find(2); Assert.AreEqual(newCD2, result); }
public ActionResult AddDetails(int id) { Dictionary <string, object> model = new Dictionary <string, object>(); CD selectedCD = CD.Find(id); List <CD> CDTitle = CD.GetCD(); model.Add("cd", selectedCD); return(View(model)); }
public ActionResult Show(int categoryId, int id) { CD myCD = CD.Find(id); Dictionary <string, object> model = new Dictionary <string, object>(); Category category = Category.Find(categoryId); model.Add("CD", myCD); model.Add("category", category); return(View(model)); }
public ActionResult Show(int artistId, int cdId) { CD cd = CD.Find(cdId); Dictionary <string, object> model = new Dictionary <string, object>(); Artist artist = Artist.Find(artistId); model.Add("cd", cd); model.Add("artist", artist); return(View(model)); }
public void Find_ReturnsTheID_int() { string name01 = "Metallica"; string name02 = "Band"; CD nameCategory1 = new CD(name01); CD nameCategory2 = new CD(name02); CD result = CD.Find(2); Assert.AreEqual(nameCategory2, result); }
public HomeModule() { Get["/"] = _ => { List <CD> allCDs = CD.GetAll(); return(View["index.cshtml", allCDs]); }; Post["/"] = _ => { string artist = Request.Form["artist-name"]; string albumTitle = Request.Form["album-title"]; if (artist != "" & albumTitle != "") { CD newCD = new CD(artist, albumTitle); List <CD> allCDs = CD.GetAll(); return(View["index.cshtml", allCDs]); } else { return(View["new_cd_form.cshtml"]); } }; Get["/CD/new"] = _ => { return(View["new_cd_form.cshtml"]); }; Get["/CD/{id}"] = parameters => { return(View["album.cshtml", CD.Find(int.Parse(parameters.id))]); }; Get["/CD/search"] = _ => { return(View["search_by_artist.cshtml"]); }; Post["/CD/search_results"] = _ => { string searchArtistName = Request.Form["artist-name"]; List <Artist> matchingArtists = Artist.GetMatchingArtists(searchArtistName); return(View["search_results.cshtml", matchingArtists]); }; }
public HomeModule() { Get["/"] = _ => { List <CD> allCds = CD.GetAll(); return(View["index.cshtml", allCds]); }; Get["/cds/new"] = _ => { return(View["cds_form.cshtml"]); }; Post["/addCD"] = _ => { var newCD = new CD(Request.Form["artist-name"], Request.Form["album-name"], Request.Form["price"]); List <CD> allCds = CD.GetAll(); return(View["index.cshtml", allCds]); }; Get["/cds/search"] = _ => { return(View["search_form.cshtml"]); }; Post["/cdsearch"] = _ => { string searchinput = Request.Form["match"]; List <CD> returnCds = new List <CD> { }; List <CD> allCds = CD.GetAll(); foreach (CD album in allCds) { if (album.SearchArtist(searchinput)) { returnCds.Add(album); } } return(View["search_results.cshtml", returnCds]); }; Get["/album/{id}"] = parameters => { // System.Console.WriteLine(parameters.id); List <CD> allCds = CD.GetAll(); CD album = CD.Find(parameters.id); return(View["/cd_detail.cshtml", album]); }; }
public ActionResult CDDetail(int id) { CD cd = CD.Find(id); return(View(cd)); }