예제 #1
0
        public virtual Acknowledgement <WishListDuplicate> AddingToWishList(WishList wishListReceived)
        {
            WishListDuplicate                   wishListDuplicate;
            List <WishListDuplicate>            WishlistDuplicateList = new List <WishListDuplicate>();
            Acknowledgement <WishListDuplicate> returnData;
            // BookingService bookingService = new BookingService();
            List <Room> roomsInWishList = new List <Room>();

            try
            {
                roomsInWishList = bookingService.DisplayWishList(wishListReceived.RenterId);
                foreach (var v in roomsInWishList)
                {
                    if (v.RoomId == wishListReceived.RoomId)
                    {
                        throw new AlreadyThereInWishList(wishListReceived.RoomId);
                    }
                }
                bookingService.AddingToWishList(wishListReceived);
                wishListDuplicate = new WishListDuplicate(wishListReceived.WishListId, wishListReceived.RenterId, wishListReceived.RoomId);
                WishlistDuplicateList.Add(wishListDuplicate);
                returnData = new Acknowledgement <WishListDuplicate>(1, WishlistDuplicateList, "Added to wishlist");
            }
            catch (AlreadyThereInWishList alreadyThere)
            {
                throw alreadyThere;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(returnData);
        }