public bool Create(Tool obj) { try { List <Tool> tool = ToolJsonProcessor.getJsonDataObject(file_path); int currentId = 1; if (tool != null) { currentId = tool.OrderByDescending(x => x.m_id).First().m_id + 1; } //if (people.Count > 0) //{ // currentId = people.OrderByDescending(x => x.Id).First().Id + 1; //} obj.m_id = currentId; string json_basedata = ToolJsonProcessor.getJsonDataString(file_path); string s = ToolJsonProcessor.AddObjectsToJson(json_basedata, obj, file_path); return(true); } catch (System.Exception ex) { string error = "Create person json file exceptio: " + ex.Message; ErrorHandling.WriteError(error, error_folder); return(false); } }
public List <Tool> RetrieveAll() { return(ToolJsonProcessor.getJsonDataObject(file_path)); }