public ClientsBusinessInformationController() { Model1 = new ClientsBusinessInformation().GetType().Name; Model1FileName = AppDataFolder + "InnerAPI\\" + Model1 + ".json"; Model2 = new MDRRate().GetType().Name; Model2FileName = AppDataFolder + "InnerAPI\\" + Model2 + ".json"; FileChecker <MDRRate> .AutoCreateIfNotExists(Model2FileName); FileChecker <ClientsBusinessInformation> .AutoCreateIfNotExists(Model1FileName); }
public async Task <ClientsBusinessInformation> Save(ClientsBusinessInformation newData) { return(await Task.Run(async() => { try { clinetsbusinessinformation = await Reader <ClientsBusinessInformation> .JsonReaderListAsync(Model1FileName); clinetsbusinessinformation.Add(newData); _ = await Writer <ClientsBusinessInformation> .JsonWriterListAsync(clinetsbusinessinformation, Model1FileName); return newData; } catch { return newData; } })); }