Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }