Ejemplo n.º 1
0
        public bool DeleteByBrandId(int brandId)
        {
            bool success = true;
            IEnumerable <Promotion> list = _proRepo.GetAll().Where(p => p.BrandId == brandId);

            foreach (Promotion item in list)
            {
                _appliedSer.DeleteByPromotionId(item.Id);
                _vouSer.DeleteByPromotionId(item.Id);
                success = _proRepo.Delete(item);
                if (!success)
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
        public ActionResult DeletePromotion(int id)
        {
            bool success = _applySer.DeleteByPromotionId(id);

            if (!success)
            {
                return(Problem("Delete failed!"));
            }
            success = _vouSer.DeleteByPromotionId(id);
            if (!success)
            {
                return(Problem("Delete failed!"));
            }
            success = _proSer.Delete(id);
            if (!success)
            {
                return(Problem("Delete failed!"));
            }
            return(Ok("Delete successful!"));
        }