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); }
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))); }
public async Task <IActionResult> DeleteArtist(EditArtistBindingModel model) { bool isDeleted = await this.artistService.DeleteArtistAsync(model.Id); return(RedirectToAction(RedirectConstants.IndexSuffix)); }