示例#1
0
        public IActionResult Index()
        {
            PeopleDb        db = new PeopleDb(_connectionString);
            PeopleViewModel vm = new PeopleViewModel();

            vm.People = db.GetPeople();
            if (TempData["message"] != null)
            {
                vm.Message = (string)TempData["message"];
            }
            return(View(vm));
        }
        public MainPageViewModel()
        {
            peopleDb = new PeopleDb(Constants.DatabasePath);
            var people = peopleDb.GetPeople();

            if (people.Any())
            {
                var lastRecord = people.OrderByDescending(by => by.PersonId).First();
                firstName = lastRecord.FirstName;
                lastName  = lastRecord.LastName;
            }
        }
        public MainPageViewModel(INotificationsService notificationsService, PeopleDb peopleDb)
        {
            this.notificationsService = notificationsService;
            this.peopleDb             = peopleDb;

            var people = peopleDb.GetPeople();

            if (people.Any())
            {
                var lastRecord = people.OrderByDescending(by => by.PersonId).First();
                firstName = lastRecord.FirstName;
                lastName  = lastRecord.LastName;
            }
        }
示例#4
0
        public IActionResult Index()
        {
            PeopleDb db = new PeopleDb(_conStr);

            return(View(db.GetPeople()));
        }