Dot Net Weekly Project#37
Conversation
|
|
||
| [Route("getAllUsers")] | ||
| [HttpPost] | ||
| public IActionResult getAll([FromBody] CustomModels.CustomEmployee customEmployee) |
There was a problem hiding this comment.
Route should not contain http verbs in them . This is not restful practice
There was a problem hiding this comment.
Fixed the issue here......
| } | ||
|
|
||
| // GET api/values/5 | ||
| [HttpGet("{id}")] |
There was a problem hiding this comment.
Then what should I select for the default controller ? Because when we run the IIS Express, then by default it opens the browser for values controller.
There was a problem hiding this comment.
Can we Not Run the Application without a default Controller being Set?
There was a problem hiding this comment.
We can run the application without that, but just for checking that whether our service is running or not, I am using this.
| { | ||
| #warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings. | ||
| optionsBuilder.UseSqlServer(_config["dbConnection"]); | ||
| } |
There was a problem hiding this comment.
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
Please Go through the link and fix the mistake
There was a problem hiding this comment.
Removed the connection string from context file and startup file, and stored the connection string in appsettings.json.
| <!-- <div class="dropdown show" id="empRole" style="display: none;"> | ||
| <a class="btn-sm btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||
| Dropdown link | ||
| </a> |
There was a problem hiding this comment.
Removed the commented code.
…actices, Removed the connection string
| { | ||
|
|
||
| if((_idbo.deleteEmp(customEmployee.Username, customEmployee.JwT))) | ||
| int temp = _idbo.deleteEmp(customEmployee.Username, customEmployee.JwT); |
There was a problem hiding this comment.
Still Not Correct We should just receive an Id in case of Delete Not the Whole object
There was a problem hiding this comment.
I am sending only the token and username( which is a primary key in my case ), and all the other values will be null. The CustomModels' object gets only Username and token, and every other field will be null. From the frontend, I am passing only the username and token.
There was a problem hiding this comment.
I have made another CustomModel which will only expect Username and token.
…l for handling Delete operations which will expect only Username and the token. 3. Modified the ValuesController by deleting unnecessary routes.
Project is partially completed. User Authorization is done. ADMIN can delete and view all employees.