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 Ekleme (ADDING) – Crud
Controllers/Department DbProjectPersonelEntities db = new DbProjectPersonelEntities (); [HttpGet] //Get işleminde bu actionresult çalışsın ve sayfayı göstersin public ActionResult New() { return View(); } [HttpPost] //Sayfada post işlemi yapılınca public ActionResult New(Department department) //Viewdan gelen Department tipindeki department object'ini al { db.Department.Add(department); //Viewdan gelen bu objeyi db ye ekle db.SaveChanges(); //Değişiklikleri kaydet return RedirectToAction("Index","Department"); //Department controller'ındaki... Okumaya Devam et →
