public string Get() { var result = services.GetAll().ToList(); // return JsonConvert.SerializeObject(result); return(JsonConvert.SerializeObject(result, Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore })); }
public string Getall() { ResultObject resultt = new ResultObject(); try { var result = services.GetAll().ToList(); return(JsonConvert.SerializeObject(result, Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore })); } catch (Exception e) { resultt.Message = "EXCEPTION: " + e.Message + "Stack: " + e.StackTrace; return(JsonConvert.SerializeObject(resultt)); } }