public async Task <IActionResult> Edit(int id, ArtistFormModel model) { var artistExists = await this.artistService.ExistsAsync(id); if (!artistExists) { this.TempData.AddErrorMessage(WebAdminConstants.ArtistNotFoundMsg); return(RedirectToAction(nameof(Index))); } if (!this.ModelState.IsValid) { return(this.View(model)); } await this.artistService.UpdateAsync( id, model.Name, model.Description, model.ArtistType); this.TempData.AddSuccessMessage(string.Format( WebAdminConstants.ArtistUpdatedMsg, model.Name.ToStrongHtml(), model.ArtistType.ToString().ToStrongHtml())); return(this.RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Create(ArtistFormModel model) { if (!this.ModelState.IsValid) { return(this.View(model)); } await this.artistService.CreateAsync( model.Name, model.Description, model.ArtistType); this.TempData.AddSuccessMessage(string.Format( WebAdminConstants.ArtistCreatedMsg, model.Name.ToStrongHtml(), model.ArtistType.ToString().ToStrongHtml())); return(this.RedirectToAction(nameof(Index))); }