public async Task <ActionResult> GetStoreById(int id) { //string strint = id.Trim().ToString(); //var intid = Convert.ToInt32(strint); StoreMasterModel pro = new StoreMasterModel(); StoreMasterModelSingleRootObject obj = new StoreMasterModelSingleRootObject(); string url = GetUrl(2); url = url + "Store/GetStoreById?id=" + Convert.ToInt32(id) + ""; using (HttpClient client = new HttpClient()) { HttpResponseMessage responseMessage = await client.GetAsync(url); if (responseMessage.IsSuccessStatusCode) { var response = responseMessage.Content.ReadAsStringAsync().Result; var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore }; obj = JsonConvert.DeserializeObject <StoreMasterModelSingleRootObject>(response, settings); pro = obj.data; TempData["item"] = pro; } } return(RedirectToAction("Index")); }
public async Task <JsonResult> StoreClose() { ViewBag.StoreId = Session["StoreId"].ToString(); string url = GetUrl(2); url = url + "/Store/StoreClose?StoreId=" + ViewBag.StoreId + ""; using (HttpClient client = new HttpClient()) { HttpResponseMessage responseMessage = await client.GetAsync(url); //List<OrderStatusModel> result = new List<OrderStatusModel>(); StoreMasterModelSingleRootObject obj = new StoreMasterModelSingleRootObject(); if (responseMessage.IsSuccessStatusCode) { var response = responseMessage.Content.ReadAsStringAsync().Result; var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore }; obj = JsonConvert.DeserializeObject <StoreMasterModelSingleRootObject>(response, settings); //result = obj.data; } return(Json(obj, JsonRequestBehavior.AllowGet)); } }
public async Task <ActionResult> AddNewStore(FormCollection fc, HttpPostedFileBase file) { if (ModelState.IsValid) { int StoreId = 0; StoreMasterModel model = new StoreMasterModel(); string storeid = fc["StoreId"]; string localityid = fc["LocalityName"]; string storename = fc["StoreName"]; string phonenumber = fc["StorePhoneNumber"]; string email = fc["StoreEmailId"]; string address = fc["StoreAddress"]; string openingtime = fc["OpeningTime"]; string closingtime = fc["ClosingTime"]; ViewBag.StoreId = Session["StoreId"].ToString(); if (storeid != "0") { StoreId = Convert.ToInt32(storeid); SavePictures(StoreId, file); } string url = GetUrl(2); url = url + "Store/AddNewStore?storeid=" + storeid + "&storename=" + storename + "&phonenumber=" + phonenumber + "&email=" + email + "&address=" + address + "&opeingtime=" + openingtime + "&closingtime=" + closingtime + "&localityid=" + localityid + ""; using (HttpClient client = new HttpClient()) { HttpResponseMessage responseMessage = await client.GetAsync(url); StoreMasterModelSingleRootObject result = new StoreMasterModelSingleRootObject(); if (responseMessage.IsSuccessStatusCode) { var response = responseMessage.Content.ReadAsStringAsync().Result; var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore }; result = JsonConvert.DeserializeObject <StoreMasterModelSingleRootObject>(response); if (result.data.StoreId > 0) { StoreId = result.data.StoreId; SavePictures(StoreId, file); } } return(RedirectToAction("Index")); } } else { return(RedirectToAction("Index")); } }