Resolved Adding web page to asp.net web API

raysefo

Well-known member
Joined
Feb 22, 2019
Messages
361
Programming Experience
10+
Hello,

I have an asp.net web API. Now I would like to add a login page and sort of monitoring page to my web API. I just added View folder and created a cshtml file. But I couldn't find layouts for this view. There is no such Shared folder and _Layouts.cshtml file. Would you please guide me?

C#:
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
 
Perhaps I am missing something. It's a Web API. It is not meant to be used interactively. Why would you want to add an interactive Web UI?
 
I want to implement a management page in order to upload some data (game codes) into the database and monitor how many of them used/left etc. Would it be a better idea to build a seperate solution instead of within the API?
 
Did you not learn from your mistakes from the last time?
In computer programming, an application programming interface (API) is a set of subroutine definitions, communication protocols, and tools for building software.
~Wiki
An interface contains only the signatures of methods, properties, events or indexers. A class or struct that implements the interface must implement the members of the interface that are specified in the interface definition.
~Microsoft

Which seems more appropriate; do you think?
 
That approach is not right. It's not a separate solution you need. You need to separate your business logic (crud) entirely, your classes, helper classes, structures and properties, and interface logic, should be totally separate from your entity logic (meaning ef) entirely... Everything I mentioned should be separate. Especially the entity logic. It's easy to get sucked into breaking these principle rules when you are using a codefirst approach in EF, or if you initially start out writing a class for one purpose but you end up using it in place of one of your other logic class types instead because it becomes more than your other classes are capable of delivering and all because you allowed to break your single purpose usage rule. A good example of what I'm trying to explain can be read on Makeuseof 10 Basic Programming Principles Every Programmer Must Follow
 
Last edited:
Back
Top Bottom