Esempio n. 1
0
        private void AddClient()
        {
            var id = _dbContext.GetClients().Any() ? _dbContext.GetClients().Max(i => i.Index) : 0; //If there is none, return 0

            _dbContext.Add(new Client()
            {
                Name = Name, Age = Age.Value, Index = id + 1, LastName = LastName, Phone = Phone
            });
            Confirm = true;
            Task.Delay(3000);
            Confirm = false;
        }
Esempio n. 2
0
        public HomeViewModel(IDbContextScope dbContext)
        {
            _dbContext = dbContext;

            OrderByAgeCommand   = new DelegateCommand(OrderByAge);
            OrderByIdCommand    = new DelegateCommand(OrderById);
            DeleteClientCommand = new DelegateCommand <Client>(DeleteClient);

            Clients = _dbContext.GetClients();
        }