Using Webapi, I know a little bit about it, as in this tutorial [HttpGet] means transmission, in my first project, I have all used [httppost] effect is similar, but according to the online explanation, this method is safe, and the transmission of data is not limited, So I will use [HttpPost] in the future, but the disadvantage is not to see directly in the Web page
And some classmates may have seen the last chapter the return type of the Get function is jsonresult and inside the function, return is JSON (XX), as we see on the Web page of the data is JSON format, I used to return what data to build a model, but recently found that can use Jsonresult unified return format, MOM no longer have to worry about my data model too much, in return remember, format is json (XXX), to convert XXX to JSON format, XXX represents the data to return
Although in this tutorial does not appear these problems, but in the actual project will always encounter, please believe me, these are also C # relative to the other back-end language features, I am in the project by these problems to die, the following simple, that is, I met in the project
characteristic question, you ask me what is feature? Direct
This [key] is a feature, plus a row using to not error, this role is related to the database, if the database table has a primary key, here you need to have the primary key property set to the [key] property, or the front end is not data. The following are the wrong tips for the problem (the picture is not very full, sorry)
There is a comparison of the characteristics of the pit, then I stayed up for two days, asked the big guy, maybe I didn't say clearly, then directly
This word means that the concurrency check, as to where you will encounter this, I do not know, but I can put my error hint, it is this thing put me up for two days and two nights, I hope you classmates and the line and cherish
There is also a nullable type
After int add a?, this property is a nullable type, the role is to prevent error, because the corresponding data in the database is sometimes the default is a null value, here because I solved the problem, the map is not saved.
Finally tell the students a more practical method of checking the wrong (maybe I am more stupid, only know this), that is, if the front end can not find the back end of the data sent over, but do not know where the wrong, the [HttpPost] instead of [HttpGet], in the debugging to see if you can see the data, It is common to see the wrong here.
There is a more stupid database error-checking method, after the creation of the database data model, each data model is used [HttpGet] function to the Web page to see, anyway, I do this every time, and indeed a lot of mistakes.
Well, the next article is the front, alas, the whole stack really tired ah
(iii) Build front-end-vue ecology
(ii) 4, WEBAPI description and possible problems