public async Task <ActionResult> GetAllLocalitiesdata()
        {
            List <LocalityMasterModel> olist = new List <LocalityMasterModel>();

            string url = GetUrl(2);

            url = url + "Localities/GetAllLocalitiesWithOutPagging";

            using (HttpClient client = new HttpClient())
            {
                HttpResponseMessage responseMessage = await client.GetAsync(url);

                LocalityMasterModelRootObject result = new LocalityMasterModelRootObject();
                if (responseMessage.IsSuccessStatusCode)
                {
                    var response = responseMessage.Content.ReadAsStringAsync().Result;
                    var settings = new JsonSerializerSettings
                    {
                        NullValueHandling     = NullValueHandling.Ignore,
                        MissingMemberHandling = MissingMemberHandling.Ignore
                    };
                    result = JsonConvert.DeserializeObject <LocalityMasterModelRootObject>(response);
                    olist  = result.data;
                    ViewBag.LocalityList = olist;
                }
            }
            return(PartialView("_Localitieslist", olist));
        }
        public async Task <ActionResult> RemoveLocality(int id)
        {
            //string strint = id.Trim().ToString();
            //var intid = Convert.ToInt32(strint);
            List <LocalityMasterModel> olist = new List <LocalityMasterModel>();

            LocalityMasterModelRootObject obj = new LocalityMasterModelRootObject();

            string url = GetUrl(2);

            url = url + "Localities/RemoveLocality?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 <LocalityMasterModelRootObject>(response, settings);
                    olist = obj.data;
                    ViewBag.TransactionList = olist;
                }
            }
            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> AddNewLocalityName(FormCollection fc, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                LocalityMasterModel model = new LocalityMasterModel();
                string localityname       = fc["LocalityName"];
                string url = GetUrl(2);
                url = url + "Localities/AddNewLocalityName?localityname=" + localityname + "";

                using (HttpClient client = new HttpClient())
                {
                    HttpResponseMessage responseMessage = await client.GetAsync(url);

                    LocalityMasterModelRootObject result = new LocalityMasterModelRootObject();
                    if (responseMessage.IsSuccessStatusCode)
                    {
                        var response = responseMessage.Content.ReadAsStringAsync().Result;
                        var settings = new JsonSerializerSettings
                        {
                            NullValueHandling     = NullValueHandling.Ignore,
                            MissingMemberHandling = MissingMemberHandling.Ignore
                        };
                        result = JsonConvert.DeserializeObject <LocalityMasterModelRootObject>(response);
                        int localityId = result.data.LocalityId;
                        if (localityId > 0)
                        {
                            var allowedExtensions = new[]
                            {
                                ".Jpg", ".png", ".jpg", "jpeg", ".JPG",
                            };


                            //string imagepath = "http://103.233.79.234/Data/EverGreen_Android/LocalityPictures/";
                            model.ImageUrl = file.ToString();                               //getting complete url
                            var fileName = Path.GetFileName(file.FileName);                 //getting only file name(ex-ganesh.jpg)
                            var ext      = Path.GetExtension(file.FileName);                //getting the extension(ex-.jpg)
                            if (allowedExtensions.Contains(ext))                            //check what type of extension
                            {
                                string name   = Path.GetFileNameWithoutExtension(fileName); //getting file name without extension
                                string myfile = +localityId + ext;                          //appending the name with id
                                                                                            // store the file inside ~/project folder(Img)
                                                                                            //var path = Path.Combine(imagepath, myfile);
                                string path = @"C:\inetpub\wwwroot\Data\EverGreen_Android\LocalityPictures\" + Server.HtmlEncode(myfile);
                                model.ImageUrl = path;
                                file.SaveAs(path);
                            }
                        }
                        else
                        {
                            ViewBag.message = "Please choose only Image file";
                        }
                    }
                    return(View("Index"));
                }
            }
            else
            {
                return(View("Index"));
            }
        }
        // GET: StoreMaster
        public async Task <ActionResult> Index()
        {
            ViewBag.LoginID  = Session["LoginID"].ToString();
            ViewBag.Username = Session["Username"].ToString();
            ViewBag.Message  = "Your application Daily Activity page.";
            //return View();

            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;
                }
            }
            StoreMasterModel menu = (StoreMasterModel)TempData["item"];

            return(View(menu));
        }