Пример #1
0
        protected override void Init()
        {
            Products     = new List <TrainingProduct>();
            SearchEntity = new TrainingProduct();
            Entity       = new TrainingProduct();

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

            AddMode();
        }
Пример #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());
        }
Пример #4
0
        public bool Update(TrainingProduct entity)
        {
            var ret = false;

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

            return(ret);
        }
Пример #5
0
        public bool Insert(TrainingProduct entity)
        {
            var ret = false;

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

            return(ret);
        }
Пример #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);
        }
Пример #7
0
 private void ResetSearch()
 {
     SearchEntity = new TrainingProduct();
 }
Пример #8
0
 public bool Delete(TrainingProduct entity)
 {
     //TODO: delete code here
     return(true);
 }