예제 #1
0
        public PromotionDTO Save(Promotion promotion)
        {
            _promotionRepository.Add(promotion);
            _promotionRepository.Save();

            return(Mapper.Map <PromotionDTO>(promotion));
        }
예제 #2
0
        /// <summary>
        /// Method to add new contact
        /// </summary>
        /// <param name="cnt"></param>
        /// <returns></returns>
        public string AddPromotion(PromotionModel cnt)
        {
            if (cnt != null)
            {
                int result = _myPromotions.Add(cnt);

                if (result == 1)
                {
                    return("Promotion Added");
                }
                else if (result == 4)
                {
                    return("Promotion name already exists");
                }
                else
                {
                    return("Invalid Promotion");
                }
            }
            else
            {
                return("Invalid Promotion");
            }
        }