コード例 #1
0
 public async Task <FirmwareUpgrade> CreateFirmwareUpgrade(FirmwareUpgrade upgrade)
 {
     try
     {
         db.Entry(upgrade).State = EntityState.Added;
         await db.SaveChangesAsync();
     }
     catch (Exception e)
     {
         Trace.TraceError("Error saving logging device: {0}", e);
         return(null);
     }
     return(upgrade);
 }
コード例 #2
0
        public async Task <LoggingDevice> RegisterLoggingDevice(string deviceId, string deviceName)
        {
            LoggingDevice newDevice = new LoggingDevice
            {
                DeviceName   = deviceId,
                FriendlyName = deviceName
            };

            try
            {
                db.Entry(newDevice).State = EntityState.Added;
                await db.SaveChangesAsync();
            }
            catch (Exception e)
            {
                Trace.TraceError("Error saving logging device: {0}", e);
                return(null);
            }
            return(newDevice);
        }
コード例 #3
0
 public Task CreateAsync(WebUser user)
 {
     db.WebUsers.Add(user);
     return(db.SaveChangesAsync());
 }