Click here to Skip to main content
15,121,030 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: ASP.Net Core Web API Exception - Can't Find System.Data.Linq Pin
Richard Deeming2-Nov-21 2:14
mveRichard Deeming2-Nov-21 2:14 
GeneralRe: ASP.Net Core Web API Exception - Can't Find System.Data.Linq Pin
Kevin Marois2-Nov-21 5:34
professionalKevin Marois2-Nov-21 5:34 
AnswerRe: ASP.Net Core Web API Exception - Can't Find System.Data.Linq Pin
Richard Deeming11-Oct-21 23:11
mveRichard Deeming11-Oct-21 23:11 
GeneralRe: ASP.Net Core Web API Exception - Can't Find System.Data.Linq Pin
Kevin Marois12-Oct-21 8:34
professionalKevin Marois12-Oct-21 8:34 
GeneralRe: ASP.Net Core Web API Exception - Can't Find System.Data.Linq Pin
#realJSOP2-Nov-21 2:01
mva#realJSOP2-Nov-21 2:01 
QuestionSecuring A Web API Pin
Kevin Marois20-Sep-21 12:51
professionalKevin Marois20-Sep-21 12:51 
AnswerRe: Securing A Web API Pin
#realJSOP2-Nov-21 2:06
mva#realJSOP2-Nov-21 2:06 
GeneralRe: Securing A Web API Pin
Kevin Marois2-Nov-21 5:35
professionalKevin Marois2-Nov-21 5:35 
QuestionLaravel 8 how to add elements to navbar app.blade Pin
paradox0215-Sep-21 3:01
Memberparadox0215-Sep-21 3:01 
QuestionSSL Certificate Pin
Kevin Marois26-Aug-21 8:23
professionalKevin Marois26-Aug-21 8:23 
AnswerRe: SSL Certificate Pin
Richard Deeming26-Aug-21 22:52
mveRichard Deeming26-Aug-21 22:52 
GeneralRe: SSL Certificate Pin
Kevin Marois20-Sep-21 10:23
professionalKevin Marois20-Sep-21 10:23 
GeneralRe: SSL Certificate Pin
Richard Deeming20-Sep-21 22:47
mveRichard Deeming20-Sep-21 22:47 
GeneralRe: SSL Certificate Pin
Kevin Marois21-Sep-21 5:22
professionalKevin Marois21-Sep-21 5:22 
GeneralRe: SSL Certificate Pin
Richard Deeming21-Sep-21 6:36
mveRichard Deeming21-Sep-21 6:36 
GeneralRe: SSL Certificate Pin
Kevin Marois21-Sep-21 7:02
professionalKevin Marois21-Sep-21 7:02 
GeneralRe: SSL Certificate Pin
Richard Deeming21-Sep-21 7:37
mveRichard Deeming21-Sep-21 7:37 
GeneralRe: SSL Certificate Pin
Kevin Marois21-Sep-21 7:53
professionalKevin Marois21-Sep-21 7:53 
GeneralRe: SSL Certificate Pin
SlothTheCoder29-Oct-21 16:11
professionalSlothTheCoder29-Oct-21 16:11 
QuestionAPI Controller Question Pin
Kevin Marois26-Aug-21 7:13
professionalKevin Marois26-Aug-21 7:13 
AnswerRe: API Controller Question Pin
Richard Deeming26-Aug-21 7:41
mveRichard Deeming26-Aug-21 7:41 
GeneralRe: API Controller Question Pin
Kevin Marois26-Aug-21 8:28
professionalKevin Marois26-Aug-21 8:28 
GeneralRe: API Controller Question Pin
Richard Deeming26-Aug-21 22:41
mveRichard Deeming26-Aug-21 22:41 
Kevin Marois wrote:
So to follow the REST standard, I would have to decorate each method with the Http Verbs?

Yes. But you'd probably want to do that anyway - for example, you don't want actions which modify the data to be available via GET requests.

Kevin Marois wrote:
How would this signature look in the API?

Depends on how you set up the routes. For example, if you don't have a RoutePrefix attribute on your controller:
C#
public class JobsController : _ApiControllerBase
{
    [HttpGet("api/projects/{projectId:int}/jobs")]
    public List<JobEntity> GetJobsForProject(int projectId) { ... }
}
However, my gut feeling is that this action would fit better as part of a ProjectsController:
C#
[RoutePrefix("api/projects")
public class ProjectsController : _ApiControllerBase
{
    [HttpGet("")]
    public IEnumerable<ProjectEntity> GetAllProjects() { ... }
    
    [HttpGet("{id:int}")]
    public ProjectEntity GetProject(int id) { ... }
    
    [HttpGet("{id:int}/jobs")]
    public IEnumerable<JobEntity> GetJobsForProject(int id) { ... }
    
    [HttpPost("")]
    public int AddProject([FromBody] ProjectEntity entity) { ... }
    
    [HttpPut("{id:int}")]
    public void UpdateProject([FromBody] ProjectEntity entity) { ... }
    
    [HttpDelete("{id:int}")]
    public void DeleteProject(int id) { ... }
}

Attribute Routing in ASP.NET Web API 2 | Microsoft Docs[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

QuestionModal Question Pin
MekaC24-Aug-21 11:40
MemberMekaC24-Aug-21 11:40 
Question.Net Framework Web API - Server Error Pin
Kevin Marois23-Aug-21 12:50
professionalKevin Marois23-Aug-21 12:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.