public async Task <IActionResult> AddPodcastDetails([FromBody] PodcastDetails objPodcast) { if (!ModelState.IsValid) { return(new JsonResult("Error while creating podcast")); } _context.PodcastDetails.Add(objPodcast); await _context.SaveChangesAsync(); return(new JsonResult("Podcast created successfully.")); }
public async Task <IActionResult> UpdatePodcastDetails([FromRoute] int id, [FromBody] PodcastDetails objPodcast) { if (objPodcast == null || id != objPodcast.PodcastID) { return(new JsonResult("Podcast was not found.")); } else { _context.PodcastDetails.Update(objPodcast); await _context.SaveChangesAsync(); return(new JsonResult("Podcast updated successfully.")); } }