コード例 #1
0
 public static DeviceAppInstallation Populate(int applicaitonId, int deviceId)
 {
     try {
         marcdissertation_dbEntities ctxt = new marcdissertation_dbEntities();
         DeviceAppInstallation       dai  = (from x in ctxt.DeviceAppInstallations
                                             where x.DeviceId.Equals(deviceId) && x.ApplicationId.Equals(applicaitonId) select x).First();
         dai.context = ctxt;
         return(dai);
     } catch {
         throw new Exception("Application device pair with ID given does not exist");
     }
 }
コード例 #2
0
        public static DeviceAppInstallation CreatePairing(int applicationId, int deviceId)
        {
            DeviceAppInstallation dai = new DeviceAppInstallation();
            dai.ApplicationId = applicationId;
            dai.DeviceId = deviceId;
            dai.InstallDate = DateTime.Now;
            dai.context = new marcdissertation_dbEntities();

            dai = dai.context.DeviceAppInstallations.Add(dai);
            errors = dai.context.GetValidationErrors();

            try {
                dai.context.SaveChanges();
            } catch(Exception e) {
                throw App.ExceptionFormatter(errors);
            }
            return dai;
        }
コード例 #3
0
        public static DeviceAppInstallation CreatePairing(int applicationId, int deviceId)
        {
            DeviceAppInstallation dai = new DeviceAppInstallation();

            dai.ApplicationId = applicationId;
            dai.DeviceId      = deviceId;
            dai.InstallDate   = DateTime.Now;
            dai.context       = new marcdissertation_dbEntities();

            dai    = dai.context.DeviceAppInstallations.Add(dai);
            errors = dai.context.GetValidationErrors();

            try {
                dai.context.SaveChanges();
            } catch (Exception e) {
                throw App.ExceptionFormatter(errors);
            }
            return(dai);
        }