{"id":24906133,"url":"https://github.com/ilkeresen/mvc5popupmodalapp","last_synced_at":"2025-10-16T18:30:40.137Z","repository":{"id":273924284,"uuid":"476735768","full_name":"ilkeresen/MVC5PopupModalApp","owner":"ilkeresen","description":"Popup-Modal Yapısı Layout Kontrolü  Controller Yapısı  Model Yapısı  View Yapısı  Linq Sorguları  Entity Framework Sorguları Hazır Template Kurulumu ve Düzenlenmesi  CSS Kontrolleri  Bootstrap Yapısı ","archived":false,"fork":false,"pushed_at":"2022-04-01T16:13:55.000Z","size":16,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T19:37:07.762Z","etag":null,"topics":["ajax","asp-net-mvc","controller","entity-framework","javascript","json","list","modal-box","modal-dialogs","model","popup-dialog","view"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ilkeresen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-01T13:39:05.000Z","updated_at":"2025-01-23T18:44:42.000Z","dependencies_parsed_at":"2025-01-23T19:37:10.645Z","dependency_job_id":"e8bea8dd-2cd0-4a41-b41b-cbe8ad537c9a","html_url":"https://github.com/ilkeresen/MVC5PopupModalApp","commit_stats":null,"previous_names":["ilkeresen/mvc5popupmodalapp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilkeresen%2FMVC5PopupModalApp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilkeresen%2FMVC5PopupModalApp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilkeresen%2FMVC5PopupModalApp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilkeresen%2FMVC5PopupModalApp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ilkeresen","download_url":"https://codeload.github.com/ilkeresen/MVC5PopupModalApp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236738661,"owners_count":19196962,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ajax","asp-net-mvc","controller","entity-framework","javascript","json","list","modal-box","modal-dialogs","model","popup-dialog","view"],"created_at":"2025-02-02T00:38:50.073Z","updated_at":"2025-10-16T18:30:39.777Z","avatar_url":"https://github.com/ilkeresen.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MVC5PopupModalApp\n\u003ch2\u003eMurat Yücedağ hocama sevgiler :)\u003c/h2\u003e\nTema ve Tablolar responsive DataTable ile yapıldı.\u003cbr\u003e\n\n  `Güncelleme,Silme,Detay,Ekleme` crud işlemleri için `popup-modal` kullanıldı.\u003cbr\u003e\n  `Listeleme` için `PartialView` yapısı kullanıldı.\u003cbr\u003e\n  \nFrontend için görüntüleri aşağıdaki gibidir. \u003cp\u003e\u003c/p\u003e\n  \n![](https://i.hizliresim.com/r182duw.jpg)\n![](https://i.hizliresim.com/r78vs8t.jpg)\n![](https://i.hizliresim.com/5rfchmj.jpg)\n![](https://i.hizliresim.com/8qgysvv.jpg)\n![](https://i.hizliresim.com/fuyxc7o.jpg)\n![](https://i.hizliresim.com/ory25xg.jpg) \u003cp\u003e\n`author.js` ajax işlemleri ile id değerimizi post methodu ile controller'a iletiyoruz dönen değerleri foreach ile listeliyoruz. `$.each`\n \u003c/p\u003e\n \n![](https://i.hizliresim.com/a0hqbca.jpg)\n\n\n ```javascript\n \n ///////////////////////////////////////YAZARLAR//////////////////////////////////////////////\n//YAZAR SİLME\n$(document).on(\"click\", \".AuthorDelete\", function () {\n  var id = $(this).attr(\"data-id\");\n  $(\"#AuthorID\").val(id);\n});\n\n$(\"#AuthorDelete\").click(function () {\n  var id = $(\"#AuthorID\").val();\n  $.ajax({\n    type: \"POST\",\n    url: \"/Author/AuthorDelete/\",\n    data: { \"id\": id },\n    dataType: \"json\",\n    success: function () {\n      window.location.href = \"/Author/Index/\";\n    }\n  });\n});\n//YAZAR GÜNCELLEME\n$(document).on(\"click\", \".AuthorUpdate\", function () {\n  var id = $(this).attr(\"data-id\");\n  $(\"#AuthorID\").val(id);\n  $.ajax({\n    type: \"POST\",\n    url: \"/Author/AuthorGetItem/\" + id,\n    dataType: \"json\",\n    success: function (data) {\n      $(\"#UpdateAuthorID\").val(data.AuthorID);\n      $(\"#UpdateAuthorName\").val(data.AuthorName);\n      $(\"#UpdateAuthorSurname\").val(data.AuthorSurname);\n      $(\"#UpdateAuthorDetail\").val(data.AuthorDetail);\n    }\n  });\n});\n$(\"#AuthorUpdate\").click(function () {\n  var updatedata = $(\"#AuthorUpdateForm\").serialize();\n  $.ajax({\n    type: \"POST\",\n    url: \"/Author/AuthorUpdate/\",\n    data: updatedata,\n    dataType: \"json\",\n    success: function () {\n      window.location.href = \"/Author/Index/\";\n    }\n  });\n});\n//YAZAR EKLEME\n$(\"#AuthorAdd\").click(function () {\n  var updatedata = $(\"#AuthorAddForm\").serialize();\n  $.ajax({\n    type: \"POST\",\n    url: \"/Author/AuthorAdd/\",\n    data: updatedata,\n    dataType: \"json\",\n    success: function () {\n      window.location.href = \"/Author/Index/\";\n    }\n  });\n});\n//YAZAR DETAY\n$(document).on(\"click\", \".AuthorDetail\", function () {\n  var id = $(this).attr(\"data-id\");\n  $.ajax({\n    type: \"POST\",\n    url: \"/Author/AuthorGetItem/\" + id,\n    dataType: \"json\",\n    success: function (data) {\n      $(\"#DetailAuthorID\").val(data.AuthorID);\n      $(\"#DetailAuthorName\").val(data.AuthorName);\n      $(\"#DetailAuthorSurname\").val(data.AuthorSurname);\n      $(\"#DetailAuthorDetail\").val(data.AuthorDetail);\n    }\n  });\n});\n\n$(document).on(\"click\", \".Book\", function () {\n  var id = $(this).attr(\"data-id\");\n  $.ajax({\n    type: \"POST\",\n    url: \"/Author/AuthorGetBook/\" + id,\n    dataType: \"json\",\n    success: function (data) {\n      if (data != 0) {\n        $('#AuthorBook').empty();\n        var numberid = 0;\n        $.each(data, function (i, item) {\n          var rows = \"\u003ctr\u003e\"\n            + \"\u003ctd\u003e\" + (++numberid) + \"\u003c/td\u003e\"\n            + \"\u003ctd\u003e\" + item.BookName + \"\u003c/td\u003e\"\n            + \"\u003ctd\u003e\" + item.BookAuthor + \"\u003c/td\u003e\"\n            + \"\u003ctd\u003e\" + item.BookPublisher + \"\u003c/td\u003e\"\n            + \"\u003c/tr\u003e\";\n          $('#AuthorBook').append(rows);\n        });\n      }\n      else {\n        $('#AuthorBook').empty();\n        var rows = \"\u003ctr\u003e\"\n          + \"\u003ctd colspan='4' style='text-align:center;'\u003e\" + \" Yazara Ait Kitap Bulunamadı. \" + \"\u003c/td\u003e\"\n          + \"\u003c/tr\u003e\";\n        $('#AuthorBook').append(rows);\n      }\n    }\n  });\n});\n\n \n ```\n \u003cbr\u003e\nView bölümünde stabil bootstrap modal yapımızı oluşturuyoruz ek olarak table body bölümüne  id = \"istenilen_isim\"  ekliyoruz ve işlemlerimizi bitiriyoruz. Index.cshtml bölümünde tüm kodlar mevcut.\n\u003cbr\u003e\n\n![](https://i.hizliresim.com/ge6pc4g.jpg)\n\n```javascript\n\u003c!-- BOOKS MODAL --\u003e\n\u003cdiv class=\"modal fade\" id=\"modal-book\" style=\"display: none;\" aria-hidden=\"true\"\u003e\n    \u003cdiv class=\"modal-dialog\"\u003e\n        \u003cdiv class=\"modal-content\"\u003e\n            \u003cdiv class=\"modal-header bg-dark\"\u003e\n                \u003ch4 class=\"modal-title\"\u003e\u003ci class=\"fas fa-book\"\u003e\u003c/i\u003e Yazar Kitapları\u003c/h4\u003e\n                \u003cbutton type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"\u003e\n                    \u003cspan aria-hidden=\"true\"\u003e×\u003c/span\u003e\n                \u003c/button\u003e\n            \u003c/div\u003e\n            \u003cdiv class=\"modal-body\"\u003e\n                \u003ctable class=\"table table-bordered table-hover\"\u003e\n                    \u003cthead\u003e\n                        \u003ctr\u003e\n                            \u003cth\u003e#\u003c/th\u003e\n                            \u003cth\u003eKitap Adı\u003c/th\u003e\n                            \u003cth\u003eYazar Adı Soyadı\u003c/th\u003e\n                            \u003cth\u003eKitap Yayınevi\u003c/th\u003e\n                        \u003c/tr\u003e\n                    \u003c/thead\u003e\n                    \u003ctbody id=\"AuthorBook\"\u003e\n                    \u003c/tbody\u003e\n                    \u003ctfoot\u003e\n                        \u003ctr\u003e\n                            \u003cth\u003e#\u003c/th\u003e\n                            \u003cth\u003eKitap Adı\u003c/th\u003e\n                            \u003cth\u003eYazar Adı Soyadı\u003c/th\u003e\n                            \u003cth\u003eKitap Yayınevi\u003c/th\u003e\n                        \u003c/tr\u003e\n                    \u003c/tfoot\u003e\n                \u003c/table\u003e\n            \u003c/div\u003e\n            \u003cdiv class=\"modal-footer justify-content-between\"\u003e\n                \u003cbutton type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\"\u003eVazgeç\u003c/button\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n    \u003c/div\u003e\n\u003c/div\u003e\n```\n\n\u003cp\u003e\n\nController da ise Yazara ait kitapları getirmemiz için TBLBook tablosunda bulunan BookAuthor stünundaki değer ile bizim yolladığımız id değerini karşılaştırıyoruz eşit olan id'leri listeliyoruz.\n\u003c/p\u003e\n  \n![](https://i.hizliresim.com/448nmjv.jpg)\n\n\n```javascript\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Web;\nusing System.Web.Mvc;\nusing MVC5Library.Models;\n\nnamespace MVC5Library.Controllers\n{\n    public class AuthorController : Controller\n    {\n        // GET: Author\n        DbLibraryEntities Context = new DbLibraryEntities();\n        public ActionResult Index()\n        {\n            return View();\n        }\n\n        public PartialViewResult AuthorList()\n        {\n            List\u003cTBLAuthor\u003e tBLAuthor = Context.TBLAuthor.Where(x =\u003e x.AuthorStatus == true).ToList();\n            return PartialView(tBLAuthor);\n        }\n\n        [HttpPost]\n        public JsonResult AuthorGetBook(int id)\n        {\n            var areas = Context.TBLBook\n            .Where(x =\u003e x.BookAuthor == id)\n            .Select(y =\u003e new\n            {\n                BookID = y.BookID.ToString(),\n                BookName = y.BookName,\n                BookAuthor = y.TBLAuthor.AuthorName + \" \" + y.TBLAuthor.AuthorSurname,\n                BookPublisher = y.BookPublisher\n            });\n            //var liste = Context.TBLBook.Where(x =\u003e x.BookAuthor == id).Count();\n            return Json(areas, JsonRequestBehavior.AllowGet);\n        }\n\n        [HttpPost]\n        public JsonResult AuthorDelete(int id)\n        {\n            TBLAuthor tBLAuthor = Context.TBLAuthor.Where(x =\u003e x.AuthorID == id).SingleOrDefault();\n\n            if (tBLAuthor != null)\n            {\n                tBLAuthor.AuthorStatus = false;\n                Context.SaveChanges();\n                TempData[\"item\"] = tBLAuthor.AuthorName;\n                TempData[\"icon\"] = \"fa-trash-alt\";\n                TempData[\"message\"] = \"YAZAR SİLİNDİ.\";\n                TempData[\"alert\"] = \"danger\";\n            }\n\n            return Json(tBLAuthor, JsonRequestBehavior.AllowGet);\n        }\n        [HttpPost]\n        public JsonResult AuthorGetItem(int id)\n        {\n            TBLAuthor tBLAuthor = Context.TBLAuthor.Where(x =\u003e x.AuthorID == id).FirstOrDefault();\n            TBLAuthor NewtBLAuthor = new TBLAuthor();\n\n            if (tBLAuthor != null)\n            {\n                NewtBLAuthor.AuthorID = tBLAuthor.AuthorID;\n                NewtBLAuthor.AuthorName = tBLAuthor.AuthorName;\n                NewtBLAuthor.AuthorSurname = tBLAuthor.AuthorSurname;\n                NewtBLAuthor.AuthorDetail = tBLAuthor.AuthorDetail;\n            }\n\n            return Json(NewtBLAuthor, JsonRequestBehavior.AllowGet);\n        }\n        [HttpPost]\n        public JsonResult AuthorUpdate(TBLAuthor tBLAuthor)\n        {\n            TBLAuthor GettBLAuthor = Context.TBLAuthor.Find(tBLAuthor.AuthorID);\n\n            if (GettBLAuthor != null)\n            {\n                GettBLAuthor.AuthorID = tBLAuthor.AuthorID;\n                GettBLAuthor.AuthorName = tBLAuthor.AuthorName;\n                GettBLAuthor.AuthorSurname = tBLAuthor.AuthorSurname;\n                GettBLAuthor.AuthorDetail = tBLAuthor.AuthorDetail;\n                Context.SaveChanges();\n                TempData[\"item\"] = tBLAuthor.AuthorName;\n                TempData[\"icon\"] = \"fa-edit\";\n                TempData[\"message\"] = \"KATEGORİ GÜNCELLENDİ.\";\n                TempData[\"alert\"] = \"info\";\n            }\n\n            return Json(GettBLAuthor, JsonRequestBehavior.AllowGet);\n        }\n        [HttpPost]\n        public JsonResult AuthorAdd(TBLAuthor tBLAuthor)\n        {\n            if (tBLAuthor != null)\n            {\n                tBLAuthor.AuthorStatus = true;\n                Context.TBLAuthor.Add(tBLAuthor);\n                Context.SaveChanges();\n                TempData[\"item\"] = tBLAuthor.AuthorName + \" \" + tBLAuthor.AuthorSurname;\n                TempData[\"icon\"] = \"fa-check\";\n                TempData[\"message\"] = \"YAZAR EKLENDİ.\";\n                TempData[\"alert\"] = \"dark\";\n            }\n\n            return Json(tBLAuthor, JsonRequestBehavior.AllowGet);\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filkeresen%2Fmvc5popupmodalapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filkeresen%2Fmvc5popupmodalapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filkeresen%2Fmvc5popupmodalapp/lists"}