public TrainingProductViewModel() { EventCommand = ViewModels.EventCommand.List.ToString(); IsSearchAreaVisible = true; IsListAreaVisible = true; IsValid = true; Mode = "List"; ProductForCreation = new TrainingProduct { ProductName = "", Price = 0, IntroductionDate = DateTime.Today, Url = "" }; }
public void Update(TrainingProduct product) { var entry = db.Entry(product); entry.State = EntityState.Modified; /* * var r = Get(product.ProductId); * r.ProductName = product.ProductName; * r.Price = product.Price; * r.IntroductionDate = product.IntroductionDate; * r.Url = product.Url; */ db.SaveChanges(); }
public void Add(TrainingProduct product) { db.TrainingProducts.Add(product); db.SaveChanges(); }