Exemplo n.º 1
0
        public async Task <int> EditArtistAsync(EditArtistBindingModel model)
        {
            var artist = this.DbContext
                         .Artists
                         .FirstOrDefault(x => x.Id == model.Id);

            if (artist == null)
            {
                return(ErrorId);
            }

            artist.Description       = model.Description;
            artist.PhotoURL          = model.PhotoURL;
            artist.HighLightVideoURL = model.HighLightVideoURL;
            artist.AdditionalInfoURL = model.AdditionalInfoURL;

            if (artist.HighLightVideoURL.Contains(CommonConstants.OriginalVideoUrlPart))
            {
                artist.HighLightVideoURL = ModifyVideoURL_Embeded.ModifyEmbed(artist.HighLightVideoURL);
            }

            await this.DbContext.SaveChangesAsync();

            return(artist.Id);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> EditArtist(EditArtistBindingModel model)
        {
            if (!this.ModelState.IsValid)
            {
                SetErrorMessage(CommonConstants.DangerMessage);

                return(this.EditArtist(model.Id));
            }

            int generatedId = await this.artistService.EditArtistAsync(model);

            if (generatedId < 1)
            {
                return(RedirectToAction(RedirectConstants.IndexSuffix));
            }

            return(Redirect(string.Format(RedirectConstants.AdministratorAreaArtistDetailsPage, generatedId)));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> DeleteArtist(EditArtistBindingModel model)
        {
            bool isDeleted = await this.artistService.DeleteArtistAsync(model.Id);

            return(RedirectToAction(RedirectConstants.IndexSuffix));
        }