public void UpdateCantvData(
            int _option,
            CantvItemViewModel _cantvItemViewModel)
        {
            this.SetStatusControls(true);

            var oldListCantv = this.listCantvs
                               .Where(
                cd => cd.CantvDataId == _cantvItemViewModel.CantvDataId)
                               .FirstOrDefault();

            switch (_option)
            {
            case -1:
                this.listCantvs.Remove(oldListCantv);
                break;

            case 0:
                oldListCantv = _cantvItemViewModel;
                break;

            case 1:
                this.listCantvs.Add(_cantvItemViewModel);
                break;
            }

            this.Cantvs = new ObservableCollection <CantvItemViewModel>(
                this.listCantvs
                .OrderBy(lcd => lcd.CodePhone)
                .ThenBy(lcd => lcd.NumberPhone));

            this.SetStatusControls(false);
        }
 private CantvDataItem ToCantvItem(CantvItemViewModel _editCantv)
 {
     return(new CantvDataItem
     {
         CantvDataId = _editCantv.CantvDataId,
         CodePhone = _editCantv.CodePhone,
         NumberPhone = _editCantv.NumberPhone,
         UserId = mainViewModel.UserData.UserId,
     });
 }
        public GetCantvViewModel(
            CantvItemViewModel _cantvItemViewModel)
        {
            //  Generate an instance of the services class
            apiService        = new ApiService();
            dialogService     = new DialogService();
            navigationService = new NavigationService();

            //  Load values data of CantvDataItemViewModel
            this.cantvItemView = _cantvItemViewModel;

            //  Search data Cantv
            FindDataCantv();
        }
 private void SetInitialize(
     int _option,
     CantvItemViewModel _editCantvData)
 {
     if (_option == 0)
     {
         this.CodePhone    = "";
         this.NuberPhone   = "";
         this.MessageLabel = "";
     }
     else if (_option == 1)
     {
         this.CodePhone  = _editCantvData.CodePhone;
         this.NuberPhone = _editCantvData.NumberPhone;
     }
 }
        public EditCantvViewModel(
            CantvItemViewModel _editCantvData)
        {
            //  Load value object
            this.editCantv = _editCantvData;

            //  Define control format
            SetInitialize(1, _editCantvData);
            SetStatusControl(true, false, 0);

            //  Gets an instances of the services class
            apiservices       = new ApiService();
            dialogService     = new DialogService();
            navigationService = new NavigationService();

            //  Gets an instance of the CantvViewModel
            cantvViewModel = CantvViewModel.GetInstance();

            //  Gets an instance of the MainViewModel
            mainViewModel = MainViewModel.GetInstance();
        }