Beispiel #1
0
        public static bool WriteDbInfo(DatabaseInfo dbInfo)
        {
            if (dbInfo == null)
            {
                return(false);
            }
            dbInfo.ProjectId = ThisApp.Project.Id;
            string info = ConvertDbInfoToJson(dbInfo);
            List <DatabaseInfo> lstDbInfo = GetListDbInfo();

            if (lstDbInfo == null)
            {
                lstDbInfo = new List <DatabaseInfo>();
            }
            DatabaseInfo exists = lstDbInfo.Where(p => p.Id == dbInfo.Id).FirstOrDefault();

            if (exists == null)
            {
                dbInfo.Id = lstDbInfo.Count() + 1;
                lstDbInfo.Add(dbInfo);
            }
            else
            {
                exists = dbInfo.DeepClone();
            }
            WriteListDbInfo(lstDbInfo);
            return(true);
        }