示例#1
0
 public ActionResult Add([Bind(Prefix = "Artist")]Artist artist, UploadImagePopupViewModel uploadImagePopupViewModel)
 {
     AddArtistViewModel addArtistViewModel = new AddArtistViewModel();
     addArtistViewModel.Artist = artist;
     addArtistViewModel.UploadImagePopupViewModel = uploadImagePopupViewModel;
     return ManageArtist(addArtistViewModel);
 }
示例#2
0
 public ActionResult Add()
 {
     AddArtistViewModel addArtistViewModel = new AddArtistViewModel();
     addArtistViewModel.UploadImagePopupViewModel = new UploadImagePopupViewModel();
     PrepareViewDataForAddAction();
     return View(addArtistViewModel);
 }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }