c# yanlış bir yer varmı asp.net core
using System;
using Microsoft.AspNetCore.Mvc;
namespace calismaalanim.webui.Controllers
{
public class csharpController : Controller
{
[Route("/csharp/metot-asiri-yükleme-method-overloading")]
public IActionResult methodoverloading()
{
return View();
}
[Route("/csharp/metot-parametreleri-method-parameters")]
public IActionResult methodparameters()
{
return View();
}
[Route("/csharp/metotlar-methods")]
public IActionResult methods()
{
return View();
}
[Route("/csharp/diziler-arrays")]
public IActionResult arrays()
{
return View();
}
[Route("/csharp/break-ve-continue")]
public IActionResult breakcontinue()
{
return View();
}
[Route("/csharp/for-dongusu")]
public IActionResult forloop()
{
return View();
}
[Route("/csharp/while-dongusu")]
public IActionResult whileloop()
{
return View();
}
[Route("/csharp/switch")]
public IActionResult myswitch()
{
return View();
}
[Route("/csharp/if-else")]
public IActionResult ifelse()
{
return View();
}
[Route("/csharp/bool-degerleri-booleans")]
public IActionResult booleans()
{
return View();
}
[Route("/csharp/yazilar-strings")]
public IActionResult strings()
{
return View();
}
[Route("/csharp/matematik-math")]
public IActionResult math()
{
return View();
}
[Route("/csharp/operatorler-operators")]
public IActionResult operators()
{
return View();
}
[Route("/csharp/kullanici-girisi-user-input")]
public IActionResult userinput()
{
return View();
}
[Route("/csharp/tip-dokumu-type-casting")]
public IActionResult typecasting()
{
return View();
}
[Route("/csharp/veri-tipleri-data-types")]
public IActionResult datatypes()
{
return View();
}
public IActionResult degiskenler()
{
return View();
}
[Route("/csharp/yorum-satirlari-comments")]
public IActionResult comments()
{
return View();
}
[Route("/csharp/soz-dizimi-syntax")]
public IActionResult syntax()
{
return View();
}
public IActionResult baslangic()
{
return View();
}
[Route("/csharp")]
public IActionResult csharptanitim()
{
return View();
}
}
}
yanlış bir yer varmı
Route tanımlamanı uzun uzun yazmana gerek yok. zaten controller isminden alıyor. Alt sayfalarını farklı layoutları yoksa tek bir actions dan yapmalısın.
public class csharpController : Controller{
/* /csharp/Index
* /csharp
*
*/
public IActionResult Index() { ... }
/*
*
* /csharp/metot-asiri-yükleme-method-overloading
* /csharp/sayfa-ismi
*
*/
[Route("{slug}")]
public IActionResult Page(string slug){
return View();
}
}