public ActionResult Add([Bind(Prefix = "Artist")]Artist artist, UploadImagePopupViewModel uploadImagePopupViewModel) { AddArtistViewModel addArtistViewModel = new AddArtistViewModel(); addArtistViewModel.Artist = artist; addArtistViewModel.UploadImagePopupViewModel = uploadImagePopupViewModel; return ManageArtist(addArtistViewModel); }
public ActionResult Add() { AddArtistViewModel addArtistViewModel = new AddArtistViewModel(); addArtistViewModel.UploadImagePopupViewModel = new UploadImagePopupViewModel(); PrepareViewDataForAddAction(); return View(addArtistViewModel); }
public ActionResult Edit(Guid id, FormCollection formCollection) { Artist artist = ArtistManager.GetByID(id); UpdateModel<Artist>(artist, "Artist"); UploadImagePopupViewModel uploadImagePopupViewModel = new UploadImagePopupViewModel(); UpdateModel<UploadImagePopupViewModel>(uploadImagePopupViewModel); AddArtistViewModel addArtistViewModel = new AddArtistViewModel(); addArtistViewModel.Artist = artist; addArtistViewModel.UploadImagePopupViewModel = uploadImagePopupViewModel; return ManageArtist(addArtistViewModel); }
private ActionResult ManageArtist(AddArtistViewModel addArtistViewModel) { Artist artist = addArtistViewModel.Artist; UploadImagePopupViewModel uploadImagePopupViewModel = addArtistViewModel.UploadImagePopupViewModel; IListenToUser user = (IListenToUser)this.HttpContext.User; if (uploadImagePopupViewModel.ImageMetaData != null) { artist.ProfileImage = uploadImagePopupViewModel.ImageMetaData; } try { ArtistManager.Save(artist, user.UserCredentials); } catch (ValidationException e) { e.AddToModelState(ViewData.ModelState, "Artist"); PrepareViewDataForEditAction(artist); return View(addArtistViewModel); } return RedirectToArtist(artist); }
public ActionResult Edit(Guid id) { Artist artist = ArtistManager.GetByID(id); AddArtistViewModel addArtistViewModel = new AddArtistViewModel(); addArtistViewModel.Artist = artist; addArtistViewModel.UploadImagePopupViewModel = new UploadImagePopupViewModel(); addArtistViewModel.UploadImagePopupViewModel.ImageMetaData = artist.ProfileImage; PrepareViewDataForEditAction(artist); return View(addArtistViewModel); }