Example #1
0
 public ShoplistViewModel(Shoplist s)
 {
     Id          = s.Id;
     Name        = s.Name;
     Description = s.Description;
     LocationId  = s.LocationId;
     AddedUserId = s.AddedUserId;
 }
Example #2
0
 public ShoplistViewModel(Shoplist shops)
 {
     if (shops != null)
     {
         Id          = shops.Id;
         Name        = shops.Name;
         Store       = shops.Store;
         AddedUserId = shops.AddedUserId;
         Description = shops.Description;
     }
 }
Example #3
0
 public ShoplistViewModel(Shoplist shop)
 {
     Shopitems = new List <Shopitem>();
     if (shop != null)
     {
         ID            = shop.Id;
         Name          = shop.Name;
         Store         = shop.Store;
         Description   = shop.Description;
         CreatedUserId = shop.CreatedUserId;
     }
 }
Example #4
0
 public bool Delete(Guid id)
 {
     try
     {
         HttpResponseMessage resp = client.DeleteAsync(UrlHelper.ShopList_Url + @"/DeleteShopList/" + id).Result;
         Shoplist            t    = JsonConvert.DeserializeObject <Shoplist>(resp.Content.ReadAsStringAsync().Result);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Example #5
0
        public async Task <IHttpActionResult> DeleteShopList(Guid id)
        {
            Shoplist storage = _shoplistRepository.GetSingle(e => e.Id == id);

            if (storage == null)
            {
                return(NotFound());
            }

            await _shoplistRepository.DeleteAsync(storage);


            return(Ok(storage));
        }
Example #6
0
        public bool Edit(Guid id, Shoplist data)
        {
            var content = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("Name", data.Name.ToString()),
                new KeyValuePair <string, string>("Description", data.Description.ToString()),
                new KeyValuePair <string, string>("LocationId", data.LocationId.ToString()),
                new KeyValuePair <string, string>("AddedUserId", data.CreatedUserId.ToString()),
            });

            try
            {
                HttpResponseMessage resp = client.PutAsync(UrlHelper.ShopList_Url + @"/PutShopList/" + id, content).Result;
                Shoplist            t    = JsonConvert.DeserializeObject <Shoplist>(resp.Content.ReadAsStringAsync().Result);
                return(true);
            }
            catch
            {
                return(false);
            }
        }