Пример #1
0
        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."));
            }
        }
Пример #2
0
 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"));
     }
 }
Пример #3
0
 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."));
     }
 }