CREATE AND UPDATE IN ONE VIEW [HttpGet] //Get işleminde bu actionresult çalışsın ve sayfayı göstersin public ActionResult New() { return View("DepartmentForm", new Department()); //New aciton result'u çalışınca (Domain/Deparment/New) DepartmentForm view'ini döndür ve buraya boş bir department modeli yolla (validation control için gerekli) } [HttpPost] //Post işleminde bu actionresult çalışsın ve ekleme işlemini yapsın public ActionResult... Okumaya Devam et →
Departman Güncelleme (UPDATE) – crUd
Controllers/Department DbProjectPersonnel db = new DbProjectPersonnel(); [HttpGet] public ActionResult Update(int id) //Dbde hangi satırı güncelleyeceğiz gelen gelen id'ye göre ilgili satırı bul { var model = db.Department.Find(id); if (model == null) //Kullanıcının elle değer girmesini engellemek için örn Department/Update/1855 (1855'i kendi elle girerse) return HttpNotFound(); return View(model); //Burada model dolu olduğu için html helperlarımız otomatik... Okumaya Devam et →
