// A simple method that does something with the user-submitted data public SelectedDataText DoSomething(UserSelectedData newItem) { var o = new SelectedDataText(); // Artist var artist = ds.Artists.Find(newItem.ArtistId); o.ArtistName = (artist == null) ? "(not found)" : artist.Name; // Album var album = ds.Albums .Include("Tracks") .SingleOrDefault(a => a.AlbumId == newItem.AlbumId); o.AlbumTitle = (album == null) ? "(not found)" : album.Title; // Tracks if (album == null) { o.TrackNames.Add("(not found)"); } else { // Get the track names for the selected tracks foreach (var item in album.Tracks) { if (newItem.TrackIds.Contains(item.TrackId)) { o.TrackNames.Add(item.Name); } } } return(o); }
public ActionResult DoSomething(UserSelectedData newItem) { if (!ModelState.IsValid) { return(RedirectToAction("index")); } else { // Do something var o = m.DoSomething(newItem); return(View(o)); } }
public ActionResult DoSomething(UserSelectedData newItem) { if (!ModelState.IsValid) { return RedirectToAction("index"); } else { // Do something var o = m.DoSomething(newItem); return View(o); } }
// A simple method that does something with the user-submitted data public SelectedDataText DoSomething(UserSelectedData newItem) { var o = new SelectedDataText(); // Artist var artist = ds.Artists.Find(newItem.ArtistId); o.ArtistName = (artist == null) ? "(not found)" : artist.Name; // Album var album = ds.Albums .Include("Tracks") .SingleOrDefault(a => a.AlbumId == newItem.AlbumId); o.AlbumTitle = (album == null) ? "(not found)" : album.Title; // Tracks if (album == null) { o.TrackNames.Add("(not found)"); } else { // Get the track names for the selected tracks foreach (var item in album.Tracks) { if (newItem.TrackIds.Contains(item.TrackId)) { o.TrackNames.Add(item.Name); } } } return o; }