コード例 #1
0
 public string Delete(string courseid, string id)
 {
     try
     {
         Member member = dbContext.Member.FirstOrDefault(u => u.CourseId.Equals(courseid) && u.MemberId.Equals(id));
         dbContext.Member.Remove(member);
         dbContext.SaveChangesAsync();
         return(JsonConvert.SerializeObject("Delete from Member OK - Remote DB"));
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(ex.Message));
     }
 }
コード例 #2
0
 public string Delete(string id)
 {
     try
     {
         Course course = dbContext.Course.FirstOrDefault(u => u.CourseId.Equals(id));
         dbContext.Course.Remove(course);
         dbContext.SaveChangesAsync();
         return(JsonConvert.SerializeObject("Delete from Course OK - Remote DB"));
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(ex.InnerException.Message));
     }
 }