예제 #1
0
        public async Task Maps_Name_From_Email_In_Claim()
        {
            var presentId = Guid.NewGuid();
            var idOfCreator = Guid.NewGuid();
            var secondPersonId = Guid.NewGuid();
            var thirdPersonId = Guid.NewGuid();


            var wishlist =
                new WishlistBuilder(idOfCreator)
                    .AddPerson(secondPersonId)
                    .AddPerson(thirdPersonId)
                    .AddPresentIdea(secondPersonId, "desc 1", presentId)
                    .AddClaimer(presentId, thirdPersonId)
                    .Build();


            IUserRepository wishlistSummariesRepo = new InMemoryWishlistSummaryRepository();
            await wishlistSummariesRepo.AddWishlistToPerson(idOfCreator, wishlist.Id);
            await wishlistSummariesRepo.AddWishlistToPerson(secondPersonId, wishlist.Id);
            await wishlistSummariesRepo.AddWishlistToPerson(thirdPersonId, wishlist.Id);
            await wishlistSummariesRepo.SetEmailAndName(secondPersonId, "*****@*****.**", "Second person");
            await wishlistSummariesRepo.SetEmailAndName(thirdPersonId, "*****@*****.**", "Third person");

            var mapper = new WishlistMapper(wishlistSummariesRepo);
            var model = await mapper.Map(wishlist);
            var presentIdeaModels = model.People
                .Single(s => s.PersonId == secondPersonId)
                .PresentIdeas;
            var claimer = presentIdeaModels
                .Single(s => s.Id == presentId);

            claimer.ClaimerName.Should().Be("Third person");            
            claimer.ClaimerEmail.Should().Be("*****@*****.**");
        }
예제 #2
0
        public async Task <WishlistIndexViewModel> GetIndexAsync(int hoarderID)
        {
            var wishlistItems = await wishlistDbService.GetAllAsync(hoarderID);

            var vm = WishlistMapper.ToIndexViewModel(wishlistItems);

            return(vm);
        }
예제 #3
0
        public async Task <WishlistCreateViewModel> GetCreateDataAsync(int hoarderID)
        {
            var itemTypeList = await wishlistItemTypeDbService.GetAllAsync();

            var priorityList = await priorityDbService.GetAllAsync();

            var languageList = await languageDbService.GetAllAsync();

            return(WishlistMapper.ToCreateViewModel(hoarderID, itemTypeList, priorityList, languageList));
        }
예제 #4
0
        public List <WishlistGridModel> GetMyWishlist(string ownerId, Guid countryId)
        {
            List <WishlistGridModel> listGridModel = new List <WishlistGridModel>();
            var wishlists = _repository.GetAll(ownerId, countryId);

            foreach (var wishlist in wishlists)
            {
                listGridModel.Add(WishlistMapper.MapToWishlistGridModel(wishlist, _adService.GetAdAsAdWishlistGridModel(wishlist.AdId)));
            }

            return(listGridModel);
        }
예제 #5
0
 public WishlistController(
     WishlistMapper wishlistMapper,
     IWishlistRepository repository,
     IUserRepository wishlistSummaryRepository,
     IMediator mediator, IUpdateWishlistHub updateWishlistHub)
 {
     this.wishlistMapper        = wishlistMapper;
     _repository                = repository;
     _wishlistSummaryRepository = wishlistSummaryRepository;
     _mediator          = mediator;
     _updateWishlistHub = updateWishlistHub;
 }
예제 #6
0
        public async Task <WishlistUpdateViewModel> GetUpdateDataAsync(int id)
        {
            var item = await wishlistDbService.GetUpdateDataAsync(id);

            var itemTypeList = await wishlistItemTypeDbService.GetAllAsync();

            var priorityList = await priorityDbService.GetAllAsync();

            var languageList = await languageDbService.GetAllAsync();

            return(WishlistMapper.ToUpdateViewModel(item, itemTypeList, priorityList, languageList));
        }
예제 #7
0
        public async Task <bool> UpdateResultsInDuplicateEntryAsync(WishlistUpdateViewModel wishlistUpdateViewModel)
        {
            var updatedItem = WishlistMapper.ToExistingWishlistItem(wishlistUpdateViewModel);

            return(await wishlistDbService.CommandResultsInDuplicateEntryAsync(updatedItem));
        }
예제 #8
0
        public async Task <bool> CreateResultsInDuplicateEntryAsync(WishlistCreateViewModel wishlistCreateViewModel)
        {
            var newItem = WishlistMapper.ToNewWishlistItem(wishlistCreateViewModel);

            return(await wishlistDbService.CommandResultsInDuplicateEntryAsync(newItem));
        }
예제 #9
0
        public async Task UpdateAsync(WishlistUpdateViewModel wishlistUpdateViewModel)
        {
            var updatedItem = WishlistMapper.ToExistingWishlistItem(wishlistUpdateViewModel);

            await wishlistDbService.UpdateAsync(updatedItem);
        }
예제 #10
0
        public async Task CreateAsync(WishlistCreateViewModel wishlistCreateViewModel)
        {
            var newItem = WishlistMapper.ToNewWishlistItem(wishlistCreateViewModel);

            await wishlistDbService.CreateAsync(newItem);
        }