示例#1
0
        public ActionResult Desinscription(int id)
        {
            var infoVM = new InfoViewModel
            {
                TitrePage = "Désinscription de la lettre d'information d'Hermétistes"
            };
            Utilisateurs u = db.Utilisateurs.Find(id);

            if (u == null)
            {
                infoVM.ResumeInfoTitre = "Erreur";
                infoVM.DetailInfo      = "L'utilisateur ayant cherché à se désinscrire n'existe plus.";
            }
            else
            {
                u.InscritLettreInfo = false;
                try
                {
                    db.SaveChanges();
                    infoVM.ResumeInfoTitre = "Désinscription enregistrée.";
                    infoVM.DetailInfo      = u.Prenom + " " + u.Nom + ", vous avez bien été enlevé(e) de notre liste de diffusion.";
                    infoVM.Ajout           = "<p> Si c'est une erreur, vous pouvez vous réinscrire "
                                             + "en cliquant <a href='/Admin/Publipostage/Inscription/" + u.IdUtilisateur + "'> ici</a></p>.";
                }
                catch
                {
                    infoVM.ResumeInfoTitre = "Echec de la désinscription.";
                    infoVM.DetailInfo      = u.Prenom + " " + u.Nom + ", un problème est survenu lors de votre désinscription de notre liste de diffusion.";
                    infoVM.Ajout           = "<p>Nous vous conseillons de réessayer dans quelques instants.</p>";
                }
            }
            return(View("Info", infoVM));
        }
示例#2
0
        public async Task <InfoViewModel> Create(Author author)
        {
            //Jeśli taki autor już istnieje to nie ma sensu znowu go dodawać
            var autorExists =
                await UnitOfWork.AuthorRepository.Any(
                    x =>
                    x.FirstName.Equals(author.FirstName) && x.LastName.Equals(author.LastName) &&
                    x.LastNameForDisplay.Equals(author.LastNameForDisplay));

            var vm = new InfoViewModel();

            if (!autorExists)
            {
                await UnitOfWork.AuthorRepository.Add(author);

                vm.Message = "Nowy autor został utworzony";
            }
            else
            {
                var msg = "Autor " + author.FirstName + " " + author.LastName + " już istnieje";
                vm.Errors = new List <string> {
                    msg
                };
            }

            return(vm);
        }
示例#3
0
        public ActionResult Inscription(int id)
        {
            var infoVM = new InfoViewModel
            {
                TitrePage = "Inscription à la lettre d'information d'Hermétistes"
            };
            Utilisateurs u = db.Utilisateurs.Find(id);

            if (u == null)
            {
                infoVM.ResumeInfoTitre = "Erreur";
                infoVM.DetailInfo      = "L'utilisateur ayant cherché à s'inscrire n'existe plus.";
            }
            else
            {
                u.InscritLettreInfo = true;
                try
                {
                    db.SaveChanges();
                    infoVM.ResumeInfoTitre = "Inscription enregistrée.";
                    infoVM.DetailInfo      = u.Prenom + " " + u.Nom + ", vous avez bien été inscrit(e) à notre liste de diffusion.";
                }
                catch
                {
                    infoVM.ResumeInfoTitre = "Echec de l'inscription.";
                    infoVM.DetailInfo      = u.Prenom + " " + u.Nom + ", un problème est survenu lors de votre inscription à notre liste de diffusion.";
                    infoVM.Ajout           = "<p>Nous vous conseillons de réessayer dans quelques instants.</p>";
                }
            }
            return(View("Info", infoVM));
        }
        public async void WishlistCommand_returns_WishlistCount()
        {
            //Arrange

            var infoVM = new InfoViewModel(_apiService);

            infoVM.User = new User {
                Id = Guid.Parse("00000000-0000-0000-0000-000000000001"), FirstName = "test", LastName = "test", BirthDate = DateTime.Now.AddYears(-18).Date, Nationality = "testland", Email = "*****@*****.**", Password = "******", Token = token, Role = "Admin"
            };
            var country = GetCountry().Result;

            infoVM.Init(country);
            int expected = infoVM.Wishlists.Count + 1;

            //Act
            country.countryWishlists.Add(new Wishlist {
                Id = Guid.NewGuid(), UserId = infoVM.User.Id
            });
            infoVM.Init(country);
            int actual  = infoVM.Wishlists.Count;
            int current = actual;

            //Assert
            Assert.Equal(expected, actual);
        }
示例#5
0
        public static InfoViewModel ToViewModel(this List <Info> sources)
        {
            var result = new InfoViewModel();

            result.AboutUs          = sources.FirstOrDefault(c => c.Type == InfoType.AboutUs)?.Value;
            result.Address          = sources.FirstOrDefault(c => c.Type == InfoType.Address)?.Value;
            result.BaleAccount      = sources.FirstOrDefault(c => c.Type == InfoType.BaleAccount)?.Value;
            result.InstagramAccount = sources.FirstOrDefault(c => c.Type == InfoType.InstaAccount)?.Value;
            result.PhoneNumber1     = sources.FirstOrDefault(c => c.Type == InfoType.PhoneNumber1)?.Value;
            result.PhoneNumber2     = sources.FirstOrDefault(c => c.Type == InfoType.PhoneNumber2)?.Value;
            result.PhoneNumber3     = sources.FirstOrDefault(c => c.Type == InfoType.PhoneNumber3)?.Value;
            result.PhoneNumber4     = sources.FirstOrDefault(c => c.Type == InfoType.PhoneNumber4)?.Value;
            result.SoroushAccount   = sources.FirstOrDefault(c => c.Type == InfoType.SoroushAccount)?.Value;
            result.TelegramAccount  = sources.FirstOrDefault(c => c.Type == InfoType.TelegramAccount)?.Value;

            var bitPay = sources.FirstOrDefault(c => c.Type == InfoType.Bitpay);

            result.BitpayPassword = bitPay?.Password;
            result.BitpayUserName = bitPay?.UserName;

            var instagram = sources.FirstOrDefault(c => c.Type == InfoType.InstagramAccount);

            result.InstagramPassword = instagram?.Password;
            result.InstagramUserName = instagram?.UserName;

            return(result);
        }
示例#6
0
 public InfoView()
 {
     InitializeComponent();
     _infoViewModel = new InfoViewModel();
     PersonManager.InfoViewModel = _infoViewModel;
     DataContext = _infoViewModel;
 }
示例#7
0
        public ActionResult Info(int id)
        {
            var gig = unitOfWork.gigRepository.ArtistGigWithArtistAndAttendances(id);

            if (gig == null)
            {
                return(HttpNotFound());
            }

            var UserId = User.Identity.GetUserId();

            var info = new InfoViewModel
            {
                Artist       = gig.Artist,
                Vanue        = gig.Venue,
                DateTime     = gig.DateTime,
                relationship = unitOfWork.relationshipRepository.GetRelationships(),
                UserId       = UserId
            };

            if (gig.Attendances.Any(a => a.AttendeeId == UserId && a.GigId == id))
            {
                info.Attending = true;
            }

            if (unitOfWork.relationshipRepository.GetRelationships().Any(f => f.FollowerId == gig.ArtistId && f.FolloweeId == UserId))
            {
                info.Following = true;
            }

            return(View(info));
        }
示例#8
0
 public InfoView()
 {
     InitializeComponent();
     _infoViewModel = new InfoViewModel(delegate() { Dispatcher.Invoke(Persons.Items.Refresh); });
     PersonManager.InfoViewModel = _infoViewModel;
     DataContext = _infoViewModel;
 }
示例#9
0
        public void SetProject_ProjectNull_ExpectedValuesAndPropertyChangedEventsFired()
        {
            // Setup
            var viewModel = new InfoViewModel();

            var propertyNames = new List <string>();

            viewModel.PropertyChanged += (sender, args) =>
            {
                propertyNames.Add(args.PropertyName);
            };

            // Call
            viewModel.SetProject(null);

            // Assert
            Assert.IsNull(viewModel.ProjectName);
            Assert.IsNull(viewModel.ProjectDescription);
            Assert.IsFalse(viewModel.ProjectDescriptionEditable);
            CollectionAssert.AreEqual(new[]
            {
                nameof(viewModel.ProjectName),
                nameof(viewModel.ProjectDescription),
                nameof(viewModel.ProjectDescriptionEditable)
            }, propertyNames);
        }
示例#10
0
        public async Task <InfoViewModel> Create(Publishing publishing)
        {
            //Jeśli takie wydawnictwo już istnieje to nie ma sensu znowu go dodawać
            var publishingExists =
                await UnitOfWork.PublishingRepository.Any(
                    x => x.Name.Equals(publishing.Name) && x.NameForDisplay.Equals(publishing.NameForDisplay));

            var vm = new InfoViewModel();

            if (!publishingExists)
            {
                await UnitOfWork.PublishingRepository.Add(publishing);

                vm.Message = "Nowe wydawnictwo zostało utworzone";
            }
            else
            {
                var msg = "Wydawnictwo " + publishing.Name + " już istnieje";
                vm.Errors = new List <string> {
                    msg
                };
            }

            return(vm);
        }
示例#11
0
        public async Task <ActionResult> ChangePassword(ChangePasswordViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView("_infoPartial", InvalidModel()));
            }

            var result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword, model.NewPassword);

            if (!result.Succeeded)
            {
                return(PartialView("_infoPartial", InvalidResult("Resetowanie hasła nie powiodło się")));
            }

            var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());

            if (user == null)
            {
                return(PartialView("_infoPartial", InvalidResult("Nie odnaleziono użytkownika")));
            }

            await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

            var vm = new InfoViewModel
            {
                Message = "Hasło zostało zmienione"
            };

            return(PartialView("_infoPartial", vm));
        }
示例#12
0
        public IActionResult Edit(InfoViewModel model, int Id)
        {
            var result = _InfoRepository.Edit(model, Id);

            TempData.AddResult(result);
            return(RedirectToAction(nameof(Edit)));
        }
示例#13
0
        public IActionResult Info(int projectId)
        {
            var employees = projectDataService.GetAllEmployeesInProject(projectId)
                            .Select(e => new EmployeeViewModel
            {
                EmployeeId = e,
                FirstName  = employeeDataService.FindById(e).Result.FirstName,
                MiddleName = employeeDataService.FindById(e).Result.MiddleName,
                LastName   = employeeDataService.FindById(e).Result.LastName,
                Salary     = employeeDataService.FindById(e).Result.Salary,
                JobTitle   = jobTitleDataService.FindById(employeeDataService.FindById(e).Result.JobTitleId).Name,
                //Department = depatmentDataService.FindById(depatmentDataService.FindById(e).DepartmentId).DepartmentName,
            });

            var model = new InfoViewModel
            {
                EmployeesInProject = employees,
                Description        = projectDataService.FindProjectById(projectId).Description,
                Name      = projectDataService.FindProjectById(projectId).Name,
                StartDate = projectDataService.FindProjectById(projectId).StartDate,
                EndDate   = projectDataService.FindProjectById(projectId).EndDate
            };

            return(View(model));
        }
        // GET: Account/Edit/5
        public ActionResult Edit(int id)
        {
            if (Session["UserID"] != null || Session["UserName"] != null)
            {
                using (DataModel db = new DataModel())
                {
                    var obj = db.Infoes.Where(a => a.PersonId.Equals(id)).FirstOrDefault();
                    if (obj != null)
                    {
                        InfoViewModel model = new InfoViewModel
                        {
                            id             = obj.PersonId,
                            TelNo          = obj.TelNo,
                            AddressLine1   = obj.AddressLine1,
                            AddressLine2   = obj.AddressLine2,
                            AddressLine3   = obj.AddressLine3,
                            AddressCode    = obj.AddressCode,
                            PostalAddress1 = obj.PostalAddress1,
                            PostalAddress2 = obj.PostalAddress2,
                            PostalCode     = obj.PostalCode
                        };

                        ViewBag.userID = obj.PersonId;
                        return(View(model));
                    }
                }
            }

            return(RedirectToAction("Login"));
        }
        public InfoViewModel GetInfoViewModel(Guid personId)
        {
            var person = Repository.GetById <Person>(personId);
            var model  = new InfoViewModel()
            {
                OriginalId = person.Id,
                FirstName  = person.FirstName,
                LastName   = person.LastName,
                NationalIdentificationNumber = person.NationalIdentificationNumber,
                VatNumber = person.VatNumber,
            };

            if (person.LegalAddress != null)
            {
                model.LegalAddress = new Models.PostalAddress
                {
                    Address    = person.LegalAddress.Address,
                    City       = person.LegalAddress.City,
                    Country    = person.LegalAddress.Country,
                    PostalCode = person.LegalAddress.PostalCode,
                    Province   = person.LegalAddress.Province
                };
            }
            if (person.ShippingAddress != null)
            {
                model.ShippingAddress = new Models.PostalAddress
                {
                    Address    = person.ShippingAddress.Address,
                    City       = person.ShippingAddress.City,
                    Country    = person.ShippingAddress.Country,
                    PostalCode = person.ShippingAddress.PostalCode,
                    Province   = person.ShippingAddress.Province
                };
            }
            if (person.BillingAddress != null)
            {
                model.BillingAddress = new Models.PostalAddress
                {
                    Address    = person.BillingAddress.Address,
                    City       = person.BillingAddress.City,
                    Country    = person.BillingAddress.Country,
                    PostalCode = person.BillingAddress.PostalCode,
                    Province   = person.BillingAddress.Province
                };
            }
            if (person.ContactInfo != null)
            {
                model.PhoneNumber      = person.ContactInfo.PhoneNumber;
                model.MobileNumber     = person.ContactInfo.MobileNumber;
                model.FaxNumber        = person.ContactInfo.FaxNumber;
                model.WebsiteAddress   = person.ContactInfo.WebsiteAddress;
                model.EmailAddress     = person.ContactInfo.EmailAddress;
                model.InstantMessaging = person.ContactInfo.InstantMessaging;
            }
            model.Id = Database.People
                       .Where(p => p.OriginalId == person.Id)
                       .Select(p => p.Id)
                       .Single();
            return(model);
        }
示例#16
0
        public void SetProject_WithProject_ExpectedValuesAndPropertyChangedEventsFired()
        {
            // Setup
            var mocks   = new MockRepository();
            var project = mocks.Stub <IProject>();

            mocks.ReplayAll();

            project.Name        = "Test";
            project.Description = "Test description";

            var viewModel = new InfoViewModel();

            var propertyNames = new List <string>();

            viewModel.PropertyChanged += (sender, args) =>
            {
                propertyNames.Add(args.PropertyName);
            };

            // Call
            viewModel.SetProject(project);

            // Assert
            Assert.AreEqual(project.Name, viewModel.ProjectName);
            Assert.AreEqual(project.Description, viewModel.ProjectDescription);
            Assert.IsTrue(viewModel.ProjectDescriptionEditable);
            CollectionAssert.AreEqual(new[]
            {
                nameof(viewModel.ProjectName),
                nameof(viewModel.ProjectDescription),
                nameof(viewModel.ProjectDescriptionEditable)
            }, propertyNames);
            mocks.VerifyAll();
        }
示例#17
0
        public ActionResult Save(InfoViewModel infoModel)
        {
            if (infoModel != null)
            {
                var imageName = Path.GetFileName(infoModel.Image?.FileName);
                if (imageName != null)
                {
                    Directory.CreateDirectory(Server.MapPath("~/Files/Images"));
                    var path = Path.Combine(Server.MapPath("~/Files/Images"), imageName);
                    infoModel.Image.SaveAs(path);
                    infoModel.ImagePath = imageName;
                }
                var info = Mapper.Map <UsefulInfo>(infoModel);
                try
                {
                    if (infoModel.Id.IsNullOrWhiteSpace())
                    {
                        _usefulLinkRepository.Add(info);
                    }
                    else
                    {
                        _usefulLinkRepository.Update(info.Id, info);
                    }
                }
                catch (Exception ex)
                {
                    _logger.Error(ex, "Error occurred during saving info");
                }
            }

            return(RedirectToAction("Index"));
        }
示例#18
0
        public void GivenViewModelWithProject_WhenSettingProjectDescription_ThenExpectedValueAndPropertyChangedEventFired()
        {
            // Given
            const string description = "new description";

            var mocks   = new MockRepository();
            var project = mocks.Stub <IProject>();

            mocks.ReplayAll();

            var viewModel = new InfoViewModel();

            viewModel.SetProject(project);

            var propertyNames = new List <string>();

            viewModel.PropertyChanged += (sender, args) =>
            {
                propertyNames.Add(args.PropertyName);
            };

            // When
            viewModel.ProjectDescription = description;

            // Then
            Assert.AreEqual(description, viewModel.ProjectDescription);
            CollectionAssert.AreEqual(new[]
            {
                nameof(viewModel.ProjectDescription)
            }, propertyNames);
            mocks.VerifyAll();
        }
示例#19
0
        protected ActionResult JsonSuccessResponse(string message, Object dataItem = null)
        {
            JsonRequestBehavior jsonRequestBehaviour = JsonRequestBehavior.DenyGet;

            if (ModelState.IsValid)
            {
                var response = new InfoViewModel()
                {
                    MsgType = InfoMsgTypes.Success,
                    Message = message
                };

                if (dataItem != null)
                {
                    response.DataItem = dataItem;
                }

                Response.StatusCode = 200;
                return(new JsonNetResult()
                {
                    Data = response, JsonRequestBehavior = jsonRequestBehaviour
                });
            }
            else
            {
                return(JsonFormResponse());
            }
        }
示例#20
0
        public void GivenViewModelWithoutProject_WhenSettingProjectDescription_ThenExpectedValueAndNoPropertyChangedEventFired()
        {
            // Given
            const string description = "new description";

            var mocks = new MockRepository();

            mocks.ReplayAll();

            var viewModel = new InfoViewModel();

            var propertyNames = new List <string>();

            viewModel.PropertyChanged += (sender, args) =>
            {
                propertyNames.Add(args.PropertyName);
            };

            // When
            viewModel.ProjectDescription = description;

            // Then
            Assert.IsNull(viewModel.ProjectDescription);
            CollectionAssert.IsEmpty(propertyNames);
            mocks.VerifyAll();
        }
示例#21
0
        public IActionResult Index()
        {
            var myAccount = _userManager.GetUserAsync(HttpContext.User).Result;


            var query =
                from transactions in _context.BankUserTransactions.Where(x => x.CreditorId == myAccount.Id || x.DebitorId == myAccount.Id)
                join creditor in _context.BankUsers on transactions.CreditorId equals creditor.Id
                join debitor in _context.BankUsers on transactions.DebitorId equals debitor.Id

                select new DisplayTransaction()
            {
                Debitor             = debitor,
                Creditor            = creditor,
                BankUserTransaction = transactions,
            };


            InfoViewModel infoViewModel = new InfoViewModel();

            infoViewModel.Creditor = query.Where(x => x.Creditor.Id == myAccount.Id);
            infoViewModel.Debitor  = query.Where(x => x.Debitor.Id == myAccount.Id);

            infoViewModel.Credit = _context.BankUserTransactions.Where(x => x.CreditorId == myAccount.Id).Sum(x => x.Amount);
            infoViewModel.Debit  = _context.BankUserTransactions.Where(x => x.DebitorId == myAccount.Id).Sum(x => x.Amount);
            infoViewModel.Total  = myAccount.Amount;



            return(View(infoViewModel));
        }
示例#22
0
        //Sets up the TextBlocks on the page by getting the song information and lyrics from the MusixMatch API
        private async void SetInfoViewModelAsync(String trackId)
        {
            Retriever             retriever = new Retriever();
            MusicFromIdRootObject music     = await retriever.GetMusic(sharedData.CommonTrackId);

            LyricsRootObject lyrics = await retriever.GetLyrics(sharedData.TrackId);

            //Assigning TextBlock text to match song's info
            infoViewModel = new InfoViewModel()
            {
                AlbumName    = music.message.body.track.album_name,
                TrackName    = music.message.body.track.track_name,
                ArtistName   = music.message.body.track.artist_name,
                LyricsString = lyrics.message.body.lyrics.lyrics_body,
            };
            Title.Text     = infoViewModel.TrackName + " by " + infoViewModel.ArtistName;
            AlbumName.Text = "Album: " + infoViewModel.AlbumName;
            Lyrics.Text    = infoViewModel.LyricsString;
            if (Lyrics.Text.Equals(""))
            {
                Lyrics.Text = "No lyrics available";
            }
            //Links to YT and Spotify
            YouTubeButton.NavigateUri = new Uri("https://www.youtube.com/results?search_query=" + Title.Text);
            SpotifyButton.NavigateUri = new Uri("https://open.spotify.com/search/results/" + Title.Text);
        }
        public InfoPage()
        {
            InitializeComponent();

            BindingContext        = _viewModel = DependencyService.Resolve <InfoViewModel>();
            _viewModel.Navigation = Navigation;
        }
示例#24
0
        public ActionResult Register(RegisterViewModel model)
        {
            using (SharebookUserManager sharebookUserManager = new SharebookUserManager())
            {
                if (ModelState.IsValid)
                {
                    BusinessLayerResult <ShareBookUser> result = sharebookUserManager.RegisterUser(model);

                    if (result.Errors.Count > 0)
                    {
                        result.Errors.ForEach(x => ModelState.AddModelError("", x.Message));
                        return(View(model));
                    }



                    InfoViewModel infoViewModel = new InfoViewModel()
                    {
                        Tittle         = "Kayıt Başarılı...",
                        RedirectingUrl = "/Home/Login",
                    };
                    infoViewModel.Items.Add(" E-posta adresinize gönderilen mail ile hesabınızı aktive ediniz. Aksi halde not yazamaz, yorum yapamaz ve notları beğenme işlemini gerçekleştiremezsiniz!");


                    return(View("Info", infoViewModel));
                }
                return(View(model));
            }
        }
        public BackstageViewModel(Action <NavigationViewModel> navigate, HomeViewModel home) : base(navigate, home)
        {
            _home = home;

            OpenCommand    = new RelayCommand(_ => SelectedViewModel = _open);
            InfoCommand    = new RelayCommand(_ => SelectedViewModel = new InfoViewModel());
            AboutCommand   = new RelayCommand(_ => SelectedViewModel = new AboutViewModel());
            ImportCommand  = new RelayCommand(_ => SelectedViewModel = new ImportBasinViewModel());
            OptionsCommand = new RelayCommand(_ => SelectedViewModel = new OptionsViewModel());
            BackCommand    = new RelayCommand(Back);

            NewCommand    = new RelayCommand(New);
            SaveCommand   = new RelayCommand(Save);
            SaveAsCommand = new RelayCommand(SaveAs);

            _open = new OpenViewModel(NavigateBack);
            _open.PropertyChanged += (sender, args) => Filename = _open.Filename;

            var commandLineArgs = Environment.GetCommandLineArgs();

            if (commandLineArgs.Length == 2)
            {
                _open.Open(commandLineArgs[1]);
            }

            Reset();
        }
示例#26
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState)
        {
            base.OnCreateView(inflater, container, savedState);
            View view = this.BindingInflate(Resource.Layout.commissions_overlay_layout, null);

            bool   showIcon = this.Arguments.GetBoolean(IconBundleKey);
            string message  = this.Arguments.GetString(MessageBundleKey);
            string title    = this.Arguments.GetString(TitleBundleKey);

            if (string.IsNullOrEmpty(title) && !showIcon)
            {
                TextView messageTextView = view.FindViewById <TextView>(Resource.Id.status_message);
                RelativeLayout.LayoutParams layoutParams = messageTextView.LayoutParameters as RelativeLayout.LayoutParams;

                if (layoutParams != null)
                {
                    layoutParams.AddRule(LayoutRules.CenterInParent);
                    messageTextView.LayoutParameters = layoutParams;
                }
            }

            InfoViewModel vm = new InfoViewModel
            {
                HasIcon = showIcon,
                Message = message,
                Title   = title
            };

            this.ViewModel = vm;
            // App trackking
            GoogleAnalyticService.Instance.TrackScreen("Commissions Information");

            return(view);
        }
示例#27
0
        public ActionResult Create(InfoViewModel viewModel)
        {
            _unitOfWork.Info.Add(viewModel.Info, viewModel.Images);
            _unitOfWork.Complete();

            return(RedirectToAction("Index"));
        }
示例#28
0
 public InfoPage()
 {
     InitializeComponent();
     _viewModel = ViewModelLocator.Instance.GetViewModel <InfoViewModel>();
     _viewModel.UpdateProperties();
     BindingContext = _viewModel;
 }
示例#29
0
        //
        // GET: /Manage/Index
        public async Task <ActionResult> Index(ManageMessageId?message)
        {
            ViewBag.StatusMessage =
                message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
                : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
                : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
                : message == ManageMessageId.Error ? "An error has occurred."
                : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
                : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
                : "";

            var userId = User.Identity.GetUserId();
            var user   = (from u in db.AspNetUsers where u.Id == userId select u).SingleOrDefault();
            var index  = new IndexViewModel
            {
                HasPassword       = HasPassword(),
                PhoneNumber       = await UserManager.GetPhoneNumberAsync(userId),
                TwoFactor         = await UserManager.GetTwoFactorEnabledAsync(userId),
                Logins            = await UserManager.GetLoginsAsync(userId),
                BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId)
            };
            var info = new InfoViewModel
            {
                UserName    = user.UserName,
                FullName    = user.FullName,
                Email       = user.Email,
                PhoneNumber = user.PhoneNumber,
            };
            ManageInfo model = new ManageInfo();

            model.index = index;
            model.info  = info;
            return(View(model));
        }
示例#30
0
        public InfoPage()
        {
            InitializeComponent();

            ViewModel   = new InfoViewModel();
            DataContext = ViewModel;
        }
示例#31
0
        public void VersionIsPopulated()
        {
            // Arrange
            var vm = new InfoViewModel();

            // Act
            string version = vm.Version.ToString();

            // Assert
            Assert.IsNotNull( version );
            Assert.AreNotEqual( "0.0.0.0", version );
        }
示例#32
0
        public void CloseCommandsTriggeresEvent()
        {
            // Arrange
            var vm = new InfoViewModel();
            bool received = false;

            vm.CloseRequested += ( s, e ) => received = true;

            // Act
            vm.CloseCommand.Execute( null );

            // Assert
            Assert.IsTrue( received );
        }
        public MainWindow()
        {
            InitializeComponent();

            // Init
            idevmViewModelIDE = new IDEViewModel();
            infoViewModel = new InfoViewModel(DatabaseTableValues);
            _mainwindowviewmodel = new MainWindowViewModel(pgbStyresystem);
            ViewModelIntellisense = new IntellisenseViewModel();
            // Data context
            tabIDE.DataContext = idevmViewModelIDE;
            tabInfo.DataContext = infoViewModel;
            pgbStyresystem.DataContext = _mainwindowviewmodel;
            list.DataContext = ViewModelIntellisense.UpdatedCollection;
        }