public async Task <IActionResult> CreateAudioCms(AudioCms audioCms) { if (ModelState.IsValid) { try { if (audioCms.Id == 0) { await _audioCmsService.Create(audioCms); } else { await _audioCmsService.Update(audioCms); } return(RedirectToAction("CreateAudioCms", new { id = audioCms.Id })); } catch (Exception ex) { throw new Exception(ex.Message); } } return(View(audioCms)); }
public async Task <IActionResult> CreateAudioCms(short id = 0) { var audioCms = new AudioCms(); if (id != 0) { audioCms = await _audioCmsService.GetAll().AsNoTracking().Include(f => f.File).FirstOrDefaultAsync(a => a.Id == id); } return(View(audioCms)); }