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("*****@*****.**"); }
public async Task <WishlistIndexViewModel> GetIndexAsync(int hoarderID) { var wishlistItems = await wishlistDbService.GetAllAsync(hoarderID); var vm = WishlistMapper.ToIndexViewModel(wishlistItems); return(vm); }
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)); }
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); }
public WishlistController( WishlistMapper wishlistMapper, IWishlistRepository repository, IUserRepository wishlistSummaryRepository, IMediator mediator, IUpdateWishlistHub updateWishlistHub) { this.wishlistMapper = wishlistMapper; _repository = repository; _wishlistSummaryRepository = wishlistSummaryRepository; _mediator = mediator; _updateWishlistHub = updateWishlistHub; }
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)); }
public async Task <bool> UpdateResultsInDuplicateEntryAsync(WishlistUpdateViewModel wishlistUpdateViewModel) { var updatedItem = WishlistMapper.ToExistingWishlistItem(wishlistUpdateViewModel); return(await wishlistDbService.CommandResultsInDuplicateEntryAsync(updatedItem)); }
public async Task <bool> CreateResultsInDuplicateEntryAsync(WishlistCreateViewModel wishlistCreateViewModel) { var newItem = WishlistMapper.ToNewWishlistItem(wishlistCreateViewModel); return(await wishlistDbService.CommandResultsInDuplicateEntryAsync(newItem)); }
public async Task UpdateAsync(WishlistUpdateViewModel wishlistUpdateViewModel) { var updatedItem = WishlistMapper.ToExistingWishlistItem(wishlistUpdateViewModel); await wishlistDbService.UpdateAsync(updatedItem); }
public async Task CreateAsync(WishlistCreateViewModel wishlistCreateViewModel) { var newItem = WishlistMapper.ToNewWishlistItem(wishlistCreateViewModel); await wishlistDbService.CreateAsync(newItem); }