Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mary-georgiou-sonarsource committed Feb 23, 2024
1 parent abf4c94 commit 54e2854
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions rules/S6934/csharp/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@ When any of the controller actions is annotated with a `HttpMethodAttribute' wit
return View();
}
}
----

==== Compliant solution

[source,csharp]
----
public class PersonController : Controller
public class PersonController: Controller
{
[HttpGet]
public ActionResult Index() // Compliant, no route template is given to the attribute
Expand All @@ -42,7 +41,7 @@ When any of the controller actions is annotated with a `HttpMethodAttribute' wit
}
[Route("Person")]
public class PersonController : Controller
public class PersonController: Controller
{
[HttpGet("GetPerson")]
public ActionResult Index() // Compliant
Expand All @@ -52,13 +51,10 @@ When any of the controller actions is annotated with a `HttpMethodAttribute' wit
}
----


== Resources

=== Documentation

=== Documentation

* Microsoft Learn - https://learn.microsoft.com/en-us/aspnet/core/mvc/overview[Overview of ASP.NET Core MVC]
* Microsoft Learn - https://learn.microsoft.com/en-us/aspnet/core/mvc/controllers/routing[Routing to controller actions in ASP.NET Core]

Expand Down

0 comments on commit 54e2854

Please sign in to comment.