public bool UpdateFeatureItem(StoreFeaturedItem featuredItems)
        {
            FullAPIUri = new Uri(BaseAPIUri, $"{nameof(UpdateFeatureItem)}");


            var serializeObj = JsonConvert
                               .SerializeObject(featuredItems, Formatting.Indented, new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Include,
            });


            var buffer      = Encoding.UTF8.GetBytes(serializeObj);
            var byteContent = new ByteArrayContent(buffer);

            byteContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");

            var request = new HttpRequestMessage(HttpMethod.Put, FullAPIUri);

            request.Content = byteContent;

            var response = HttpClient.SendAsync(request);

            if (response.GetAwaiter().GetResult().IsSuccessStatusCode)
            {
                return(JsonConvert.DeserializeObject <bool>(response.GetAwaiter().GetResult().Content.ReadAsStringAsync().GetAwaiter().GetResult()));
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
 public StoredFeaturedItemDTO(StoreFeaturedItem item)
 {
     Id          = item.Id;
     Title       = item.Title;
     Description = item.Description;
     Image       = item.Image;
     MyStoreId   = item.MyStoreId;
 }
Beispiel #3
0
        public bool UpdateFeatureItem(StoreFeaturedItem updatedfeatureitem)
        {
            if (_Context.FeaturedItems.Where(f => f.Id == updatedfeatureitem.Id).ToList().Count > 0)
            {
                _Context.FeaturedItems.RemoveRange(_Context.FeaturedItems.Where(f => f.Id == updatedfeatureitem.Id).FirstOrDefault());

                _Context.FeaturedItems.Add(updatedfeatureitem);
            }

            return(Save());
        }
 public bool UpdateFeature(StoreFeaturedItem featuredItems)
 {
     throw new NotImplementedException();
 }
Beispiel #5
0
        public bool RemoveFeatureItem(StoreFeaturedItem featuredItems)
        {
            _Context.FeaturedItems.Remove(featuredItems);

            return(Save());
        }