Skip to content

Commit 2d97d2b

Browse files
committed
updates on p010, a010 and a004
1 parent 9c040e7 commit 2d97d2b

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

β€ŽC#/Answers/a004.csβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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);

β€ŽC#/Answers/a010.csβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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; }

β€ŽC#/p010.csβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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();

0 commit comments

Comments
 (0)