Exemplo n.º 1
0
 public void Init(IViewProduct view, bool isPostBack)
 {
     _view = view;
     if (!isPostBack && _webContext.ProductId > 0)
     {
         LoadData();
     }
 }
        /// <summary>
        /// Creates a new instance of the product presenter
        /// </summary>
        /// <param name="view">View to bind to</param>
        public ProductPresenter(IViewProduct view)
        {
            // Bind to all view events
            _view = view;
            _view.Add += View_Add;
            _view.Get += View_Get;
            _view.GetAll += View_GetAll;
            _view.Remove += View_Remove;
            _view.Edit += View_Edit;
            _view.Update += View_Update;

            // Create a new repository
            var sessionFactManager = new SessionFactoryManager();
            SessionContext = new SessionContext(sessionFactManager);

            _productRepository = new ProductRepository<Product>(SessionContext);
        }
 public void Init(IViewProduct view, bool isPostBack)
 {
     _view = view;
     if (!isPostBack && _webContext.ProductId > 0)
         LoadData();
 }