public async Task <ActionResult> RemoveCategory(int id) { //string strint = id.Trim().ToString(); //var intid = Convert.ToInt32(strint); List <CategoryMasterModel> olist = new List <CategoryMasterModel>(); CategoryMasterModelRootObject obj = new CategoryMasterModelRootObject(); string url = GetUrl(2); url = url + "Category/RemoveCategory?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 <CategoryMasterModelRootObject>(response, settings); olist = obj.data; ViewBag.TransactionList = olist; } } return(RedirectToAction("Index")); }
public async Task <ActionResult> FindMenuListByStore(string StoreId) { string strurl = GetUrl(2); strurl = strurl + "MenuMaster/GetAllCategoryByStoreIdForWeb?StoreId=" + StoreId; CategoryMasterModelRootObject mobj = new CategoryMasterModelRootObject(); IList <SelectListItem> mSelectList = new List <SelectListItem>(); using (HttpClient cclient = new HttpClient()) { HttpResponseMessage responseMessage = await cclient.GetAsync(strurl); if (responseMessage.IsSuccessStatusCode) { var result = responseMessage.Content.ReadAsStringAsync().Result; mobj = JsonConvert.DeserializeObject <CategoryMasterModelRootObject>(result); foreach (var item in mobj.data) { mSelectList.Add(new SelectListItem { Text = item.MenuName, Value = item.MenuId.ToString() }); } //mSelectList.Insert(0, new SelectListItem() { Value = "", Text = "Select Menu Name" }); //mSelectList.Insert(1, new SelectListItem() { Value = "0", Text = "All" }); ViewBag.MenuList = mSelectList; } } return(new JsonResult { Data = mSelectList, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); //return View(new CategoryMasterModel()); }
public async Task <ActionResult> GetAllCategoryList() { List <CategoryMasterModel> olist = new List <CategoryMasterModel>(); ViewBag.StoreId = Session["StoreId"].ToString(); string url = GetUrl(2); url = url + "Category/GetAllCategoryList?StoreId=" + ViewBag.StoreId + ""; using (HttpClient client = new HttpClient()) { HttpResponseMessage responseMessage = await client.GetAsync(url); CategoryMasterModelRootObject result = new CategoryMasterModelRootObject(); if (responseMessage.IsSuccessStatusCode) { var response = responseMessage.Content.ReadAsStringAsync().Result; var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore }; result = JsonConvert.DeserializeObject <CategoryMasterModelRootObject>(response); olist = result.data; ViewBag.LocalityList = olist; } } return(PartialView("_Categorylist", olist)); }
// GET: ProductMaster public async Task <ActionResult> Index() { ViewBag.LoginID = Session["LoginID"].ToString(); ViewBag.Username = Session["Username"].ToString(); ViewBag.StoreId = Session["StoreId"].ToString(); ViewBag.Message = "Your application Daily Activity page."; //string url = GetUrl(2); //url = url + "Localities/GetAllLocalitiesWithOutPagging"; //LocalityMasterModelRootObject obj = new LocalityMasterModelRootObject(); //using (HttpClient client = new HttpClient()) //{ // HttpResponseMessage responseMessage = await client.GetAsync(url); // if (responseMessage.IsSuccessStatusCode) // { // var result = responseMessage.Content.ReadAsStringAsync().Result; // obj = JsonConvert.DeserializeObject<LocalityMasterModelRootObject>(result); // IList<SelectListItem> LSelectList = new List<SelectListItem>(); // foreach (var item in obj.data) // { // LSelectList.Add(new SelectListItem { Text = item.LocalityName, Value = item.LocalityId.ToString() }); // } // LSelectList.Insert(0, new SelectListItem() { Value = "", Text = "Select Locality" }); // //LSelectList.Insert(1, new SelectListItem() { Value = "0", Text = "All" }); // ViewBag.LocalityList = LSelectList; // } //} //string preurl = GetUrl(2); //preurl = preurl + "Store/GetAllStoreList"; //StoreMasterModelRootObject pobj = new StoreMasterModelRootObject(); ////List<ProductMasterModel> Prlist = new List<ProductMasterModel>(); //using (HttpClient prclient = new HttpClient()) //{ // HttpResponseMessage responseMessage = await prclient.GetAsync(preurl); // if (responseMessage.IsSuccessStatusCode) // { // var result = responseMessage.Content.ReadAsStringAsync().Result; // pobj = JsonConvert.DeserializeObject<StoreMasterModelRootObject>(result); // IList<SelectListItem> ProSelectList = new List<SelectListItem>(); // foreach (var item in pobj.data) // { // ProSelectList.Add(new SelectListItem { Text = item.StoreName, Value = item.StoreId.ToString() }); // } // ProSelectList.Insert(0, new SelectListItem() { Value = "", Text = "Select Store" }); // //ProSelectList.Insert(1, new SelectListItem() { Value = "0", Text = "All" }); // ViewBag.StoreList = ProSelectList; // } //} //string murl = GetUrl(2); //murl = murl + "MenuMaster/GetAllMenuList"; //MenuMasterModelRootObject mobj = new MenuMasterModelRootObject(); ////List<MenuMasterModel> mlist = new List<MenuMasterModel>(); //using (HttpClient cclient = new HttpClient()) //{ // HttpResponseMessage responseMessage = await cclient.GetAsync(murl); // if (responseMessage.IsSuccessStatusCode) // { // var result = responseMessage.Content.ReadAsStringAsync().Result; // mobj = JsonConvert.DeserializeObject<MenuMasterModelRootObject>(result); // IList<SelectListItem> mSelectList = new List<SelectListItem>(); // foreach (var item in mobj.data) // { // mSelectList.Add(new SelectListItem { Text = item.MenuName, Value = item.MenuId.ToString() }); // } // mSelectList.Insert(0, new SelectListItem() { Value = "", Text = "Select Menu" }); // // mSelectList.Insert(1, new SelectListItem() { Value = "0", Text = "All" }); // ViewBag.MenuList = mSelectList; // } //} string Clienturl = GetUrl(2); Clienturl = Clienturl + "Category/GetAllCategoryList?StoreId=" + ViewBag.StoreId + ""; CategoryMasterModelRootObject cobj = new CategoryMasterModelRootObject(); //List<CategoryMasterModel> clist = new List<CategoryMasterModel>(); using (HttpClient cclient = new HttpClient()) { HttpResponseMessage responseMessage = await cclient.GetAsync(Clienturl); if (responseMessage.IsSuccessStatusCode) { var result = responseMessage.Content.ReadAsStringAsync().Result; cobj = JsonConvert.DeserializeObject <CategoryMasterModelRootObject>(result); IList <SelectListItem> CSelectList = new List <SelectListItem>(); foreach (var item in cobj.data) { CSelectList.Add(new SelectListItem { Text = item.CategoryName, Value = item.CategoryId.ToString() }); } CSelectList.Insert(0, new SelectListItem() { Value = "", Text = "Select Category" }); // CSelectList.Insert(1, new SelectListItem() { Value = "0", Text = "All" }); ViewBag.CategoryList = CSelectList; } } //string preurl = GetUrl(2); //preurl = preurl + "ProductMaster/GetAllProductList"; //ProductMasterModelRootObject pobj = new ProductMasterModelRootObject(); ////List<ProductMasterModel> Prlist = new List<ProductMasterModel>(); //using (HttpClient prclient = new HttpClient()) //{ // HttpResponseMessage responseMessage = await prclient.GetAsync(preurl); // if (responseMessage.IsSuccessStatusCode) // { // var result = responseMessage.Content.ReadAsStringAsync().Result; // pobj = JsonConvert.DeserializeObject<ProductMasterModelRootObject>(result); // IList<SelectListItem> ProSelectList = new List<SelectListItem>(); // foreach (var item in pobj.data) // { // ProSelectList.Add(new SelectListItem { Text = item.ProductName, Value = item.ProductId.ToString() }); // } // ProSelectList.Insert(0, new SelectListItem() { Value = "", Text = "Select Product" }); // ProSelectList.Insert(1, new SelectListItem() { Value = "0", Text = "All" }); // ViewBag.ProductList = ProSelectList; // } //} ProductMasterModel product = (ProductMasterModel)TempData["item"]; return(View(product)); }