Beispiel #1
0
        protected override void Init()
        {
            Products     = new List <TrainingProduct>();
            SearchEntity = new TrainingProduct();
            Entity       = new TrainingProduct();

            base.Init();
        }
Beispiel #2
0
        private void Add()
        {
            IsValid = true;
            Entity  = new TrainingProduct();
            Entity.IntroductionDate = DateTime.Now;
            Entity.Url   = "http://";
            Entity.Price = 0;

            AddMode();
        }
Beispiel #3
0
        public List <TrainingProduct> Get(TrainingProduct entity)
        {
            var ret = CreateMockData();

            if (!string.IsNullOrEmpty(entity.ProductName))
            {
                ret = ret.Where(_ =>
                                _.ProductName.ToLower().StartsWith(entity.ProductName, StringComparison.CurrentCultureIgnoreCase));
            }

            return(ret.ToList());
        }
Beispiel #4
0
        public bool Update(TrainingProduct entity)
        {
            var ret = false;

            ret = Validate(entity);
            if (ret)
            {
                // TODO: Create UPDATE code here
            }

            return(ret);
        }
Beispiel #5
0
        public bool Insert(TrainingProduct entity)
        {
            var ret = false;

            ret = Validate(entity);
            if (ret)
            {
                // TODO: Create INSERT code here
            }

            return(ret);
        }
Beispiel #6
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 lower case."));
                }
            }

            return(ValidationErrors.Count == 0);
        }
Beispiel #7
0
 private void ResetSearch()
 {
     SearchEntity = new TrainingProduct();
 }
Beispiel #8
0
 public bool Delete(TrainingProduct entity)
 {
     //TODO: delete code here
     return(true);
 }