public Model.WishlistListing Save(WishlistListingInsertRequest request)
        {
            var entity = _mapper.Map <Database.WishlistListing>(request);

            _context.WishlistListing.Add(entity);
            _context.SaveChanges();
            return(_mapper.Map <Model.WishlistListing>(entity));
        }
Exemplo n.º 2
0
        public static async Task <Model.WishlistListing> SaveWishlistListing(int listingId)
        {
            await TokenValidator.CheckTokenValidity();

            var wishlistInsertRequest = new WishlistListingInsertRequest
            {
                ListingId  = listingId,
                WishlistId = Preferences.Get("wishlistId", 0),
                DateAdded  = DateTime.Now
            };

            var httpClient = new HttpClient();

            var json     = JsonConvert.SerializeObject(wishlistInsertRequest);
            var content  = new StringContent(json, Encoding.UTF8, "application/json");
            var response = await httpClient.PostAsync($"{_apiUrl}/Wishlist", content);

            var jsonResult = await response.Content.ReadAsStringAsync();

            return(JsonConvert.DeserializeObject <Model.WishlistListing>(jsonResult));
        }
 public Model.WishlistListing Save(WishlistListingInsertRequest request)
 {
     return(_service.Save(request));
 }