Example #1
0
        public void GetData(Action<DataItem, Exception> callback)
        {
                var db = new ProductContext();
                var categories = db.Categories.ToList();

            // Use this to connect to the actual data service

            var item = new DataItem("Welcome to MVVM Light");
            callback(item, null);
        }
 private void ExecuteAddProductCommand(object obj)
 {
     if (!string.IsNullOrEmpty(this.SelectedProduct.ModelName) &&
         !string.IsNullOrEmpty(this.SelectedProduct.ModelNumber) &&
         !string.IsNullOrEmpty(this.SelectedProduct.Coast.ToString()) &&
         !string.IsNullOrEmpty(this.SelectedProduct.Desctiption))
     {
         var db = new ProductContext();
         db.Products.Add(this.SelectedProduct);
         db.SaveChanges();
         this.Products.Add(this.SelectedProduct);
     }
 }