public ActionResult Create(Product product) { try { var poductRep = new ProductRepository(); if (poductRep.Create(product)) return RedirectToAction("Index"); } catch { } var rep = new SubcategoryRepository(); var viewModel = new CreateProductViewModel(); viewModel.subcategories = rep.Table; viewModel.product = product; return View(viewModel); }
partial void DeleteProduct(Product instance);
partial void UpdateProduct(Product instance);
partial void InsertProduct(Product instance);
private void detach_Product(Product entity) { this.SendPropertyChanging(); entity.Subcategory = null; }
private void attach_Product(Product entity) { this.SendPropertyChanging(); entity.Subcategory = this; }