예제 #1
0
        public async Task <IActionResult> CreateNewGift(GiftToCreateDTO gift)
        {
            var giftDB = new Gift();

            if (gift.GiftType == "WishList")
            {
                giftDB = await _repo.CreateWishListGift(gift);
            }
            else if (gift.GiftType == "UserEvent")
            {
                giftDB = await _repo.CreateUserEventGift(gift);
            }


            if (giftDB == null)
            {
                return(BadRequest());
            }

            var giftToReturn = _mapper.Map <GiftToRetrunDTO>(giftDB);

            return(Ok(giftToReturn));
        }