예제 #1
0
 public int AddItem([FromBody] WhishListItem item)
 {
     using (var db = new WhishListContext())
     {
         db.WhishList.Add(item);
         db.SaveChanges();
         return(item.WhishListItemId);
     }
 }
예제 #2
0
        public async Task AddToWhishList([FromForm] WishListDTO wishListDto)
        {
            var whishList = _mapper.Map <WishListDTO, WhishListItem>(wishListDto);

            whishList = new WhishListItem
            {
                ProductId = wishListDto.ProductId,
                UserId    = wishListDto.UserId
            };

            Database.WishListPrepository.Add(whishList);
            await Database.SaveAsync();
        }