File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ public void GetUser(User user){
3333 }
3434
3535 /*
36- A repository should return a complex type object, such as a User, UserModel or UserDTO class .
36+ A repository should return a complex type object, such as a User or UserModel .
3737 */
3838 protected object FindUserInDatabase ( object query ) {
3939 return _userRepository . FindUser ( query ) ;
Original file line number Diff line number Diff line change @@ -7,9 +7,9 @@ public class UserController : Controller
77 */
88 [ HttpGet ]
99 [ Authorize ]
10- public IHttpActionResult < UserDTO > GetUserProfile ( int id )
10+ public IHttpActionResult < UserDTO > GetUserProfile ( string username )
1111 {
12- UserProfile uProfile = db . Users . FirstOrDefault ( ( p ) => p . Id == id ) ;
12+ UserProfile uProfile = db . Users . FirstOrDefault ( ( p ) => p . Username == username ) ;
1313 if ( uProfile == null )
1414 {
1515 return NotFound ( ) ;
@@ -19,7 +19,7 @@ public IHttpActionResult<UserDTO> GetUserProfile(int id)
1919 }
2020 }
2121
22- /* This class corresponds with the database table User and should only be used internally, and not sent out to the clients*/
22+ /* This class corresponds with the database table ' User' and should only be used internally, and not sent out to any clients*/
2323 public class UserProfile {
2424 public int Id { get ; set ; }
2525 public string Username { get ; set ; }
Original file line number Diff line number Diff line change @@ -11,9 +11,9 @@ public class UserController : Controller
1111 */
1212 [ HttpGet ]
1313 [ Authorize ]
14- public IHttpActionResult GetUserProfile ( int id )
14+ public IHttpActionResult GetUserProfile ( string username )
1515 {
16- UserProfile uProfile = db . Users . FirstOrDefault ( ( p ) => p . Id == id ) ;
16+ UserProfile uProfile = db . Users . FirstOrDefault ( ( p ) => p . Username == username ) ;
1717 if ( uProfile == null )
1818 {
1919 return NotFound ( ) ;
You canβt perform that action at this time.
0 commit comments