Exemplo n.º 1
0
        public ActionResult <AppliedPromotion> PostAppliedPromotion(AppliedPromotionCreateRequest entity)
        {
            bool success = _applySer.Create(entity);

            if (success)
            {
                return(Ok(entity));
            }
            return(Problem("Create failed!"));
        }
Exemplo n.º 2
0
        public bool Create(AppliedPromotionCreateRequest entity)
        {
            int proId   = entity.PromotionId;
            int storeId = entity.StoreId;
            AppliedPromotion existed = _repo.GetAll().FirstOrDefault(e => e.PromotionId == proId && e.StoreId == storeId);

            if (existed != null)
            {
                return(false);
            }
            AppliedPromotion newEntity = new AppliedPromotion();

            newEntity.PromotionId = proId;
            newEntity.StoreId     = storeId;
            return(_repo.Create(newEntity));
        }