protected override void Save() { TrainingProductManager mgr = new TrainingProductManager(); if (Mode == "Add") { // Add data to databas here mgr.Insert(Entity); } else { mgr.Update(Entity); } ValidationErrors = mgr.ValidationErrors; if (ValidationErrors.Count > 0) { IsValid = false; } if (!IsValid) { if (Mode == "Add") { AddMode(); } else { EditMode(); } } }
protected override void Edit() { TrainingProductManager mgr = new TrainingProductManager(); // we're going to set the entity/member variable to hold the current product, this is the one we're going to bind to the input area, input form for the user. Entity = mgr.Get(Convert.ToInt32(EventArgument)); EditMode(); }
// with addition of the HandleRequest, this method no longer needed to be public protected override void Get() { TrainingProductManager mgr = new TrainingProductManager(); Products = mgr.Get(SearchEntity); }
protected override void Delete() { TrainingProductManager mgr = new TrainingProductManager(); Entity = new TrainingProduct(); Entity.ProductId = Convert.ToInt32(EventArgument); mgr.Delete(Entity); Get(); ListMode(); }