update to .NET 6.0
This commit is contained in:
@@ -13,6 +13,7 @@ using CarParkValidationAPI.Interface;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using CommonAD.Models;
|
||||
using CommonAD;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace CarParkValidationAPI.Repository
|
||||
{
|
||||
@@ -30,7 +31,7 @@ namespace CarParkValidationAPI.Repository
|
||||
_context = context;
|
||||
_jwtUtils = jwtUtils;
|
||||
_appSettings = appSettings.Value;
|
||||
|
||||
|
||||
}
|
||||
public AuthenticateResponse Authenticate(AuthenticateRequest model)
|
||||
{
|
||||
@@ -84,7 +85,7 @@ namespace CarParkValidationAPI.Repository
|
||||
AuthenticateResponse retval = null;
|
||||
int statuscode = 0;
|
||||
string webAPIUrl = _appSettings.LoginWebAPI;
|
||||
|
||||
|
||||
var loginInfo = await CommonAD.WebAPIUtil.GetLoginADAsync(webAPIUrl, "CheckADCredentials", model.Username, model.Password);
|
||||
if (loginInfo != null && loginInfo.result)
|
||||
{
|
||||
@@ -132,13 +133,13 @@ namespace CarParkValidationAPI.Repository
|
||||
LDAPUser = _appSettings.LDAPUser,
|
||||
ADTimeOutStr = _appSettings.ADTimeOut
|
||||
};
|
||||
myUser = await Task.Run(() => LoginADStaff(adConfig,model.Username, model.Password));
|
||||
myUser = await Task.Run(() => LoginADStaff(adConfig, model.Username, model.Password));
|
||||
if (!string.IsNullOrEmpty(myUser.Username))
|
||||
{
|
||||
statuscode = 1;
|
||||
{
|
||||
statuscode = 1;
|
||||
// authentication successful so generate jwt token
|
||||
var jwtToken = _jwtUtils.GenerateJwtToken(myUser);
|
||||
|
||||
|
||||
retval = new AuthenticateResponse(myUser, jwtToken);
|
||||
}
|
||||
return new ResultModel<AuthenticateResponse>()
|
||||
@@ -159,7 +160,7 @@ namespace CarParkValidationAPI.Repository
|
||||
|
||||
}
|
||||
|
||||
public async Task<ResultModel<User>> GetById(int id)
|
||||
public async Task<ResultModel<User>> GetById(int id)
|
||||
{
|
||||
var user = await _context.Users.FindAsync(id);
|
||||
if (user == null) throw new KeyNotFoundException("User not found");
|
||||
@@ -190,7 +191,7 @@ namespace CarParkValidationAPI.Repository
|
||||
Data = myUser,
|
||||
StatusCode = statuscode
|
||||
};
|
||||
// return myUser;
|
||||
// return myUser;
|
||||
|
||||
}
|
||||
|
||||
@@ -236,7 +237,7 @@ namespace CarParkValidationAPI.Repository
|
||||
{
|
||||
|
||||
ADStaffLink staffLink = new ADStaffLink(adConfig);
|
||||
MyADObject myADObj = staffLink.CheckADCredentials(username,password);
|
||||
MyADObject myADObj = staffLink.CheckADCredentials(username, password);
|
||||
User user = new()
|
||||
{
|
||||
Username = myADObj.stafflinkNo,
|
||||
@@ -249,5 +250,13 @@ namespace CarParkValidationAPI.Repository
|
||||
|
||||
// return null;
|
||||
}
|
||||
public async Task<ResultModel<FileContent>> GetAllUserReport()
|
||||
{
|
||||
return new ResultModel<FileContent>
|
||||
{
|
||||
Data = null,
|
||||
StatusCode = 1
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user