public IActionResult getLearnedTopic(int id) { LearnedTopic learnedTopic = db.LearnedTopics.Find(id); if (learnedTopic != null) { return(Json(learnedTopic)); } else { return(NotFound("GET: LearnedTopic with ID = " + id + " was not found.")); } }
public IActionResult updateLearnedTopic([FromBody] LearnedTopic learnedTopic) { if (learnedTopic != null) { db.LearnedTopics.Update(learnedTopic); db.SaveChanges(); return(Json(Ok("LearnedTopic updated"))); } else { return(NotFound("UPDATE: LearnedTopic was not found")); } }
public IActionResult deleteLearnedTopic(int id) { try { LearnedTopic learnedTopic = db.LearnedTopics.Find(id); db.LearnedTopics.Remove(learnedTopic); db.SaveChanges(); return(Json(Ok("LearnedTopic deleted"))); } catch (ArgumentNullException) { return(NotFound("DELETE: LearnedTopic with ID = " + id + " was not found.")); } }