public ActionResult <Wishlist> PostWishlist(WishlistDTO wishlist) { Wishlist wishlistToCreate = new Wishlist() { OwnerName = wishlist.OwnerName, Created = DateTime.Now }; foreach (var i in wishlist.Presents) { wishlistToCreate.AddPresent(new Present(i.Name, i.Price, i.Category)); } _wishlistRepository.Add(wishlistToCreate); _wishlistRepository.SaveChanges(); return(CreatedAtAction(nameof(GetWishlist), new { id = wishlistToCreate.Id }, wishlistToCreate)); }
public bool Add(Guid adId, string currentUserId, Guid countryId) { Wishlist wishlist = new Wishlist { AdId = adId, OwnerId = currentUserId, CountryId = countryId }; if (!_repository.Exists(adId, currentUserId)) { return(_repository.Add(wishlist)); } else { return(false); } }
public void addWish(String userId, Guid gameId) { Guid userIdGuid = Guid.Empty; if (!Guid.TryParse(userId, out userIdGuid)) { throw new Exception("Invalid Guid Format"); } var user = userRepository.GetUserById(userIdGuid); var game = gameRepository.GetGamebyId(gameId); wishlistRepository.Add(new Wishlist() { Id = Guid.NewGuid(), UserId = user.Id, GameId = game.Id }); }
public async Task SaveOrDeletePerformance(string AccountId, int performanceId) { Entities.Models.Wishlist performance = await WishlistRepository.GetPerformanceByPhoneIdAndPerformanceId( AccountId, performanceId); if (performance == null) { performance = new Entities.Models.Wishlist() { AccountId = int.Parse(AccountId), PerformanceId = performanceId }; WishlistRepository.Add(performance); } else { WishlistRepository.Remove(performance); } theaterScheduleUnitOfWork.Save(); }
public Wishlist Add(Wishlist wishlist) { wishlist.Status = true; return(_wishlistRepository.Add(wishlist)); }
public void Add(Wishlist wishlist) { _wishlistRepository.Add(wishlist); }