public static UserBluetooth UserBluetoothEditPost(UserBluetoothEditModel model)
        {
            UserBluetooth bluetooth = new UserBluetooth();

            using (AttendanceTrackerDatabaseConnection context = new AttendanceTrackerDatabaseConnection())
            {
                bluetooth = context.UserBlueteeth.FirstOrDefault(x => x.Id == model.Id);

                if (bluetooth != null)
                {
                    bluetooth.Name    = model.Name;
                    bluetooth.Address = model.Address;
                }
                else
                {
                    bluetooth = new UserBluetooth();

                    bluetooth.Id      = Guid.NewGuid();
                    bluetooth.Name    = model.Name;
                    bluetooth.UserId  = model.UserId;
                    bluetooth.Address = model.Address;

                    context.UserBlueteeth.Add(bluetooth);
                }
                context.SaveChanges();
            }
            return(bluetooth);
        }
        public static UserBluetoothEditModel UserBluetoothEdit(string userId, string bluetoothId)
        {
            string addOrEdit;

            if (string.IsNullOrEmpty(bluetoothId))
            {
                UserBluetoothEditModel model = new UserBluetoothEditModel(new UserBluetooth(), "Add");
                model.UserId = new Guid(userId);
                return(model);
            }
            else
            {
                UserBluetooth bluetooth = new UserBluetooth();
                using (AttendanceTrackerDatabaseConnection context = new AttendanceTrackerDatabaseConnection())
                {
                    bluetooth = context.UserBlueteeth.FirstOrDefault(x => x.Id == new Guid(bluetoothId));
                }
                UserBluetoothEditModel model = new UserBluetoothEditModel(bluetooth, "Edit");
                return(model);
            }
        }