Beispiel #1
0
        public ResultEntity <PromoEntity> GetById(int id)
        {
            var validationResult = new ResultEntity <PromoEntity>();

            using (var promoDA = new PromoDA())
            {
                validationResult.Value = promoDA.GetById(id);
            }

            return(validationResult);
        }
Beispiel #2
0
        public ResultEntity <int> GetTotalRows(DBParamEntity dbParamEntity)
        {
            var validationResult = new ResultEntity <int>();

            using (var promoDA = new PromoDA())
            {
                validationResult.Value = promoDA.GetTotalRows(dbParamEntity);
            }

            return(validationResult);
        }
Beispiel #3
0
        public ResultEntity <IEnumerable <PromoEntity> > GetAll(DBParamEntity dbParamEntity)
        {
            var validationResult = new ResultEntity <IEnumerable <PromoEntity> >();

            using (var promoDA = new PromoDA())
            {
                validationResult.Value = promoDA.GetAll(dbParamEntity);
            }

            return(validationResult);
        }
Beispiel #4
0
        public ResultEntity <PromoEntity> Create(PromoEntity promoEntity)
        {
            var validationResult = new ResultEntity <PromoEntity>();

            promoEntity.CreatedDate = DateTime.Now;

            using (var promoDA = new PromoDA())
            {
                validationResult.Value = promoDA.Create(promoEntity);
            }

            return(validationResult);
        }
Beispiel #5
0
        public ResultEntity <int> DeleteById(int id)
        {
            var validationResult = new ResultEntity <int>();

            using (var promoDA = new PromoDA())
            {
                //var ids = new int[] { id };
                validationResult.Value = promoDA.Delete(id);

                if (validationResult.Value != 1)
                {
                    validationResult.Warning.Add("Failed delete record Promo with ID: " + id);
                    return(validationResult);
                }
            }

            return(validationResult);
        }
Beispiel #6
0
        public ResultEntity <PromoEntity> Update(PromoEntity promoEntity)
        {
            var validationResult = new ResultEntity <PromoEntity>();

            promoEntity.ModifiedDate = DateTime.Now;

            using (var promoDA = new PromoDA())
            {
                var resultUpdate = promoDA.Update(promoEntity);

                if (resultUpdate <= 0)
                {
                    validationResult.Warning.Add("Failed Updating Promo!");
                    return(validationResult);
                }

                validationResult.Value = promoEntity;
            }

            return(validationResult);
        }