Example #1
0
 public UpdateModelWrapper(UpdateModel um=null)
 {
     if (um == null)
         model = new UpdateModel();
     else
         model = um;
 }
Example #2
0
        private static async Task<int> GetRecordID(int domainID, UpdateModel um)
        {
            int recordID;
            var records = await RecordService.GetList(domainID, um.SubDomain);

            if (records.Status.Code != 1)
                throw new APIException(records.Status);


            var record = records.Records.FirstOrDefault(_ => _.Type == "A" && _.Enabled == 1);
            if (record == null)
            {
                var newRecord = await RecordService.CreateRecord(domainID, um.SubDomain, "A", um.LineName, "0.0.0.0", 0, 300);

                if (newRecord.Status.Code != 1)
                    throw new APIException(newRecord.Status);

                recordID = newRecord.Info.RecordID;
            }
            else
                recordID = record.ID;

            return recordID;
        }