public TrainingProductViewModel()
 {
     Init();
     Products     = new List <TrainingProduct>();
     SearchEntity = new TrainingProduct();
     Entity       = new TrainingProduct();
 }
 public TrainingProductViewModel()
 {
     Init();
     Products = new List<TrainingProduct>();
     SearchEntity = new TrainingProduct();
     Entity = new TrainingProduct();
     
 }
 public bool Insert(TrainingProduct entity)
 {
     bool ret = false;
     ret = Validate(entity);
     if(ret)
     {
         //TODO Create Insert Code
     }
     return ret;
 }
        private void Add()
        {
            IsValid = true;

            Entity = new TrainingProduct();
            Entity.IntroductionDate = DateTime.Now;
            Entity.Url = "http://";
            Entity.Price = 0;

            AddMode();
        }
Exemplo n.º 5
0
        public bool Insert(TrainingProduct entity)
        {
            bool ret = false;

            ret = Validate(entity);
            if (ret)
            {
                //TODO Create Insert Code
            }
            return(ret);
        }
        private void Add()
        {
            IsValid = true;

            Entity = new TrainingProduct();
            Entity.IntroductionDate = DateTime.Now;
            Entity.Url   = "http://";
            Entity.Price = 0;

            AddMode();
        }
Exemplo n.º 7
0
        public bool Validate(TrainingProduct entity)
        {
            ValidationErrors.Clear();
            if (!string.IsNullOrEmpty(entity.ProductName))
            {
                if (entity.ProductName.ToLower() == entity.ProductName)
                {
                    ValidationErrors.Add(new KeyValuePair <string, string>("ProductName", "Product Name must not be all lowercase"));
                }
            }

            return(ValidationErrors.Count == 0);
        }
        public bool Validate(TrainingProduct entity)
        {
            ValidationErrors.Clear();
            if(!string.IsNullOrEmpty(entity.ProductName))
            {
                if(entity.ProductName.ToLower() == entity.ProductName)
                {
                    ValidationErrors.Add(new KeyValuePair<string, string>("ProductName", "Product Name must not be all lowercase"));
                }
            }

            return (ValidationErrors.Count == 0);

        }
        public List<TrainingProduct> Get(TrainingProduct entity)
        {
            ValidationErrors.Clear();
            List<TrainingProduct> ret = new List<TrainingProduct>();
            

            //TODO: Add data access
            ret = CreateMockData();
            if(!string.IsNullOrEmpty(entity.ProductName))
            {
                ret = ret.FindAll(p => p.ProductName.ToLower().StartsWith(entity.ProductName, StringComparison.CurrentCultureIgnoreCase));
            }
            return ret;
        }
Exemplo n.º 10
0
        public List <TrainingProduct> Get(TrainingProduct entity)
        {
            ValidationErrors.Clear();
            List <TrainingProduct> ret = new List <TrainingProduct>();


            //TODO: Add data access
            ret = CreateMockData();
            if (!string.IsNullOrEmpty(entity.ProductName))
            {
                ret = ret.FindAll(p => p.ProductName.ToLower().StartsWith(entity.ProductName, StringComparison.CurrentCultureIgnoreCase));
            }
            return(ret);
        }
 private void ResetSearch()
 {
     SearchEntity = new TrainingProduct();
     Mode = "Search";
     
 }
 private void ResetSearch()
 {
     SearchEntity = new TrainingProduct();
     Mode         = "Search";
 }