public ActionResult AddTrack(int?id) { var a = m.AlbumWithDetailGetById(id.GetValueOrDefault()); if (a == null) { return(HttpNotFound()); } else { var o = new TrackAddForm(); o.AlbumId = a.Id; o.AlbumName = a.Name; o.GenreList = new SelectList(m.GenreGetAll(), "Name", "Name"); o.AlbumList = new MultiSelectList( items: m.AlbumGetAll(), dataValueField: "Id", dataTextField: "Name", selectedValues: new List <int>() { id.GetValueOrDefault() } ); return(View(o)); } }
// GET: Track/Create public ActionResult AddTrack() { var form = new TrackAddForm(); form.GenreList = new SelectList(m.GenreGetAll(), "Id", "Name"); return(View(form)); }
// GET: Track/Create public ActionResult AddTrack(int id) { var form = new TrackAddForm(); form.GenreList = new SelectList(m.GenreGetAll(), "Id", "Name"); form.AlbumId = id; form.AlbumName = m.AlbumGetByIdWithDetail(id).Name; return(View(form)); }
public ActionResult Create() { var form = new TrackAddForm(); form.GenreList = new SelectList (items: m.GenreGetAll(), dataValueField: "Name", dataTextField: "Name"); return(View(form)); }
// GET: Albums/Create public ActionResult AddTrack(int?id) { var addedItem = m.AlbumGetById(id.GetValueOrDefault()); if (addedItem == null) { return(HttpNotFound()); } else { var o = new TrackAddForm(); o.GenreList = new SelectList(m.GenreGetAll(), "Name", "Name"); o.AlbumId = addedItem.Id; o.AlbumName = addedItem.Name; return(View(o)); } }
// GET: Tracks/Create public ActionResult Create() { // Create a view model object var accountDetails = new AccountDetails(); // Identity object "name" (i.e. not the claim) accountDetails.UserName = HttpContext.User.Identity.Name; // Work with the current User in claims-compatible mode var identity = User.Identity as ClaimsIdentity; // Now, go through the claims... // Get the name, if present //var name = identity.FindFirst(ClaimTypes.Name); //accountDetails.ClaimsName = name == null ? "(none)" : name.Value; // Get the given name, if present var givenName = identity.FindFirst(ClaimTypes.GivenName); accountDetails.ClaimsGivenName = givenName == null ? "(none)" : givenName.Value; // Get the surname, if present var surname = identity.FindFirst(ClaimTypes.Surname); accountDetails.ClaimsSurname = surname == null ? "(none)" : surname.Value; // Get the email, if present // var email = identity.FindFirst(ClaimTypes.Email); //accountDetails.ClaimsEmail = email == null ? "(none)" : email.Value; TrackAddForm form = new TrackAddForm(); form.Clerk = givenName.Value + " " + surname.Value; form.GenreList = new SelectList(m.GenreGetAll(), "Name", "Name"); form.AlbumList = new MultiSelectList(m.AlbumGetAll(), dataValueField: "Id", dataTextField: "Name"); return(View(form)); }