public ActionResult Save(StorageCheck entity)
        {
            HttpClient httpClient = HttpClientHelper.Create(base.ApiUrl);
            var        jsonValue  = JsonSerializer.SerializeToString <StorageCheck>(entity);
            string     result     = httpClient.Insert(jsonValue);

            return(RedirectToAction("Index", "StorageCheck"));
        }
        public ActionResult Save(Product product)
        {
            HttpClient httpClient = HttpClientHelper.Create(base.ApiUrl);
            var        jsonValue  = JsonSerializer.SerializeToString <Product>(product);
            string     result     = httpClient.Insert(jsonValue);

            return(RedirectToAction("Index", "Product"));
        }
Exemple #3
0
        public ActionResult UpdateBatch(IList <OrderView> entityList)
        {
            HttpClient httpClient = HttpClientHelper.Create(base.ApiUrl);
            var        jsonValue  = JsonSerializer.SerializeToString <IList <OrderView> >(entityList);
            string     result     = httpClient.Update(jsonValue);

            return(RedirectToAction("List", "Order"));
        }
Exemple #4
0
        public ActionResult Save(OrderView entity)
        {
            HttpClient httpClient = HttpClientHelper.Create(base.ApiUrl);
            var        jsonValue  = JsonSerializer.SerializeToString <OrderView>(entity);
            string     result     = httpClient.Insert(jsonValue);

            return(RedirectToAction("List", "Order"));
        }
        public ActionResult Delete(IList <string> ids)
        {
            string     id         = ids[0];
            string     url        = base.ApiUrl + "/" + id;
            HttpClient httpClient = HttpClientHelper.Create(url);
            string     result     = httpClient.Delete();

            return(RedirectToAction("Index", "StorageCheck"));
        }
        public ActionResult UpdateBatch(IList <Product> entityList)
        {
            HttpClient httpClient = HttpClientHelper.Create(base.ApiUrl);
            var        jsonValue  = JsonSerializer.SerializeToString <IList <Product> >(entityList);
            string     result     = httpClient.Update(jsonValue);

            //return RedirectToAction("Index", "Product");
            return(View("ProductIndex"));
        }
Exemple #7
0
        public async Task Should_GetProductAsync_3029330003533()
        {
            string             barcode         = "3029330003533";
            String             userAgent       = UserAgentHelper.GetUserAgent("OpenFoodFacts4Net.ApiClient.Tests", ".Net Platform", "0.1", null);
            Uri                baseAddress     = new Uri(Constants.BaseUrl);
            HttpClient         httpClient      = HttpClientHelper.Create(baseAddress, userAgent);
            GetProductResponse productResponse = await httpClient.GetProductAsync(barcode);

            Assert.Equal("Pain de mie complet", productResponse.Product.GenericName);
        }
        public ActionResult Detail(string id)
        {
            string     url        = base.ApiUrl + "/Get/" + id;
            HttpClient httpClient = HttpClientHelper.Create(url);
            string     result     = httpClient.GetString();
            var        model      = JsonSerializer.DeserializeFromString <StorageCheck>(result);

            ViewData["STORAGECHECK_ADD_OR_EDIT"] = "E";
            return(View("StorageCheckForm", model));
        }
        public ActionResult Detail(string id)
        {
            string     url        = base.ApiUrl + "/Get/" + id;
            HttpClient httpClient = HttpClientHelper.Create(url);
            string     result     = httpClient.GetString();
            var        model      = JsonSerializer.DeserializeFromString <Product>(result);

            ViewData["PRODUCT_ADD_OR_EDIT"] = "E";
            return(View("ProductForm", model));
        }
        public ActionResult Update(StorageCheck entity)
        {
            HttpClient           httpClient = HttpClientHelper.Create(base.ApiUrl);
            IList <StorageCheck> entityList = new List <StorageCheck>();

            entityList.Add(entity);

            var jsonValue = JsonSerializer.SerializeToString <IList <StorageCheck> >(entityList);

            ViewData["U_StorageCheck_Rows"] = jsonValue;
            string result = httpClient.Update(jsonValue);

            return(RedirectToAction("Index", "StorageCheck"));
        }
Exemple #11
0
        public ActionResult Detail(string id)
        {
            string     url        = base.ApiUrl + "/Get/" + id;
            HttpClient httpClient = HttpClientHelper.Create(url);
            string     result     = httpClient.GetString();
            OrderView  model      = null;

            if (!string.IsNullOrEmpty(result) && result != "null")
            {
                model = JsonSerializer.DeserializeFromString <OrderView>(result);
            }
            ViewData["ORDER_ADD_OR_EDIT"] = "E";
            return(PartialView("OrderForm", model));
        }
Exemple #12
0
 public RemoteRepository(string serviceUrl)
 {
     _client = HttpClientHelper.Create(serviceUrl);
 }
Exemple #13
0
 public RemoteFileSystem(string serviceUrl)
 {
     _client = HttpClientHelper.Create(serviceUrl);
 }
 public RemoteDeploymentManager(string serviceUrl)
 {
     _client = HttpClientHelper.Create(serviceUrl);
 }
Exemple #15
0
 protected GenericMessageProcessingHandler(Token token)
     : base(HttpClientHelper.Create()) => _token = token;