Используя WPF / MVVM, как передать значение SelectedIndex Listbox моей ViewModel?

Вот как мы можем получить последний вставленный id в Laravel 4

public function store()
{
    $input = Input::all();

    $validation = Validator::make($input, user::$rules);

    if ($validation->passes())
    {

     $user= $this->user->create(array(
            'name'              => Input::get('name'),
            'email'             => Input::get('email'),
            'password'          => Hash::make(Input::get('password')),
        ));
        $lastInsertedId= $user->id; //get last inserted record's user id value
        $userId= array('user_id'=>$lastInsertedId); //put this value equal to datatable column name where it will be saved
        $user->update($userId); //update newly created record by storing the value of last inserted id
            return Redirect::route('users.index');
        }
    return Redirect::route('users.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.');
    }
0
задан alduin 16 January 2019 в 03:54
поделиться

1 ответ

Я думаю, что вы можете привязать свойство (предположим, оно называется SelectedIdx) в ViewModel к SelectedIndex, режим привязки можно выбрать OneWayToSourc или TwoWay.

Итак, когда вы выбрали один элемент, ваша viewModel получит selectedIndex через SelecteIdx.

0
ответ дан FranklinLee 16 January 2019 в 03:54
поделиться
Другие вопросы по тегам:

Похожие вопросы: