예제 #1
0
        public void SaveClicked()
        {
            m_view.ReadUserInput();
            Product       productDataEntity = m_viewModel.ProductData;
            List <string> lstMessages       = new List <string>();
            bool          isValid           = m_ProductDao.Validate(productDataEntity, out lstMessages);

            if (isValid)
            {
                if (productDataEntity.ProductId == 0)
                {
                    m_ProductDao.Insert(productDataEntity);
                }
                else
                {
                    m_ProductDao.Update(productDataEntity);
                }
                GetAllProduct();
            }
            else
            {
                string strMessages = String.Join(Environment.NewLine, lstMessages.Select(a => a.ToString()));
                m_view.Message = strMessages;
                m_view.ShowError();
            }
        }