Beispiel #1
0
        public void ResetPassword(int id, PasswordModel.Format_Reset model)
        {
            using (CDStudioEntities dbEntity = new CDStudioEntities())
            {
                var existingEmployee = dbEntity.Employee.Find(id);
                if (existingEmployee == null)
                {
                    throw new CDSException(10701);
                }

                existingEmployee.Password = Crypto.HashPassword(model.NewPassword);
                dbEntity.SaveChanges();
            }
        }
Beispiel #2
0
        public void ResetPassword(int id, PasswordModel.Format_Reset model)
        {
            using (CDStudioEntities dbEntity = new CDStudioEntities())
            {
                var existingIoTDevice = dbEntity.IoTDevice.Find(id);
                if (existingIoTDevice == null)
                {
                    throw new CDSException(10902);
                }

                existingIoTDevice.IoTHubDevicePW = Crypto.HashPassword(model.NewPassword);
                dbEntity.SaveChanges();
            }
        }