public HttpResponseMessage GetUser(HttpRequestMessage request, int userId) { BursifyUser user; BursifyUser userVm = null; if (_userApi.GetUserType(userId).Equals("Student")) { var student = _studentApi.GetStudent(userId); student.NumberOfViews += 1; _studentApi.SaveStudent(student); user = _userApi.GetCompletStudentUser(userId); userVm = new BursifyUserViewModel().MapStudentUser(user); } else { user = _userApi.GetCompletSponsorUser(userId); userVm = new BursifyUserViewModel().MapSponsorUser(user); } userVm.PasswordHash = null; userVm.PasswordSalt = null; var response = request.CreateResponse(HttpStatusCode.OK, userVm); return(response); }
public HttpResponseMessage GetUser(HttpRequestMessage request, string email) { BursifyUser user; BursifyUser userVm = null; Guid guid = new Guid(); //guid = Guid.NewGuid(); if (_userApi.GetUserType(email).Equals("Student", StringComparison.OrdinalIgnoreCase)) { user = _userApi.GetCompletStudentUser(email); userVm = new BursifyUserViewModel().MapStudentUser(user); } else { user = _userApi.GetCompletSponsorUser(email); userVm = new BursifyUserViewModel().MapSponsorUser(user); } userVm.PasswordHash = null; userVm.PasswordSalt = null; var response = request.CreateResponse(HttpStatusCode.OK, userVm); return(response); }
private void SetUserName(BursifyUserViewModel userVm) { if (userVm.UserType.Equals("Student", System.StringComparison.OrdinalIgnoreCase)) { var tempUser = _studentApi.GetStudent(userVm.ID); var fullName = tempUser.Firstname + " " + tempUser.Surname; userVm.Name = fullName; } else { userVm.Name = _studentApi.GetSponsor(userVm.ID).CompanyName; } }