コード例 #1
0
        public async Task <IActionResult> SemtMahallelerAl(string semtId)
        {
            try
            {
                var semtMhler = await BisiparişWebYardımcı.SemtMahallelerAl(int.Parse(semtId));

                if (semtMhler != null && semtMhler.Any())
                {
                    var selOptions = new List <string>();

                    foreach (var mh in semtMhler)
                    {
                        selOptions.Add($"<option value='{mh.Id}'>{mh.Ad}</option>");
                    }

                    return(Json(selOptions));
                }
                else
                {
                    return(Content(""));
                }
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }