Beispiel #1
0
        public void ChangeViewModel(IPageViewModel viewModel)
        {
            if (!ContentViewModels.Contains(viewModel))
            {
                ContentViewModels.Add(viewModel);
            }

            CurrentContentViewModel = ContentViewModels
                                      .FirstOrDefault(vm => vm == viewModel);
        }
Beispiel #2
0
        public HomeModelView(Utilisateur u)
        {
            Singleton.GetInstance().SetHomeModelView(this);
            curentUtilisateur = u;

            Singleton.GetInstance().SetCloud(cloud); //Instance du cloud

            if (curentUtilisateur.Token_GG != null || curentUtilisateur.Token_DP != null)
            {
                var _accesstoken = curentUtilisateur.Token_GG;
                var refreshtoken = curentUtilisateur.RefreshToken;

                cloud.GetCompteClient(curentUtilisateur.Token_DP, _accesstoken, refreshtoken);
            }
            _listModelView = new ListModelView();

            ContentViewModels.Add(new HomePageModelView());
            CurrentContentViewModel = ContentViewModels[0];

            LoadAction();
        }
Beispiel #3
0
        public HomeModelView(Utilisateur u)
        {
            Singleton.GetInstance().SetHomeModelView(this);
            curentUtilisateur = u;

            if (curentUtilisateur.CrededentielCloudRailDropbox != null)
            {
                driveBaseDropbox = new DropBoxCloud();
            }

            if (curentUtilisateur.CrededentielCloudRailGoogle != null)
            {
                driveBaseGoogle = new GoogleCloud();
            }

            _listModelView = new ListModelView(driveBaseDropbox, driveBaseGoogle);

            ContentViewModels.Add(new HomePageModelView(driveBaseDropbox, driveBaseGoogle));
            CurrentContentViewModel = ContentViewModels[0];

            LoadAction();
        }
        public int UploadImageInDataBase(HttpPostedFileBase file, ContentViewModels contentViewModel)
        {
            contentViewModel.ArticleImages = ConvertToBytes(file);
            var Content = new ArticleModels
            {
                ArticleName        = contentViewModel.ArticleName,
                ArticleDescription = contentViewModel.ArticleDescription,
                ArticleText        = contentViewModel.ArticleText,
                ArticleImages      = contentViewModel.ArticleImages
            };

            context.Articles.Add(Content);
            int i = context.SaveChanges();

            if (i == 1)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }