ShopPlatform.Web
1.0.0.0
농산물, 소프트웨어 라이선스와 개발 용역을 직접 판매하는 CodeMaru 직영 쇼핑몰입니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
ShopCustomerLoginSync.cs
이 파일의 문서화 페이지로 가기
1
using
ShopPlatform.Models
;
2
3
namespace
ShopPlatform.Services
;
4
13
public
sealed
class
ShopCustomerLoginSync
14
{
23
private
readonly
ShopUserContext
_userContext
;
32
private
readonly
ShopCustomerProfileStore
_profiles
;
41
private
readonly
ShopCustomerSession
_session
;
42
75
public
ShopCustomerLoginSync
(
76
ShopUserContext
userContext,
77
ShopCustomerProfileStore
profiles,
78
ShopCustomerSession
session)
79
{
80
_userContext
= userContext;
81
_profiles
= profiles;
82
_session
= session;
83
}
84
109
public
async Task<bool>
SyncAsync
(
string
slug)
110
{
111
if
(
_session
.IsLoggedIn)
112
{
113
return
true
;
114
}
115
116
var user = await
_userContext
.GetCurrentAsync().ConfigureAwait(
false
);
117
if
(!user.IsAuthenticated)
118
{
119
return
false
;
120
}
121
122
var profile = await
_profiles
.GetAsync(slug, user.Id).ConfigureAwait(
false
);
123
_session
.LoginFromCommonUser(user, profile);
124
return
true
;
125
}
126
183
public
async Task
SaveProfileAsync
(
string
slug,
string
name,
string
phone,
string
address,
string
email)
184
{
185
var user = await
_userContext
.GetCurrentAsync().ConfigureAwait(
false
);
186
if
(!user.IsAuthenticated)
187
{
188
return
;
189
}
190
191
var profile =
new
ShopCustomerProfile
192
{
193
UserId = user.Id,
194
Provider = user.Provider,
195
Email =
string
.IsNullOrWhiteSpace(email) ? user.Email : email.Trim(),
196
DisplayName = user.DisplayName,
197
Name =
string
.IsNullOrWhiteSpace(name) ? user.DisplayName : name.Trim(),
198
Phone = phone.Trim(),
199
Address = address.Trim()
200
};
201
202
await
_profiles
.SaveAsync(slug, profile).ConfigureAwait(
false
);
203
_session
.LoginFromCommonUser(user, profile);
204
}
205
}
ShopPlatform.Models
Definition
CartItem.cs:1
ShopPlatform.Services
Definition
CartService.cs:3
ShopPlatform.Models.ShopCustomerProfile
Definition
ShopCustomerProfile.cs:12
ShopPlatform.Services.ShopCustomerLoginSync.SyncAsync
async Task< bool > SyncAsync(string slug)
Definition
ShopCustomerLoginSync.cs:109
ShopPlatform.Services.ShopCustomerLoginSync._profiles
readonly ShopCustomerProfileStore _profiles
Definition
ShopCustomerLoginSync.cs:32
ShopPlatform.Services.ShopCustomerLoginSync._session
readonly ShopCustomerSession _session
Definition
ShopCustomerLoginSync.cs:41
ShopPlatform.Services.ShopCustomerLoginSync.ShopCustomerLoginSync
ShopCustomerLoginSync(ShopUserContext userContext, ShopCustomerProfileStore profiles, ShopCustomerSession session)
Definition
ShopCustomerLoginSync.cs:75
ShopPlatform.Services.ShopCustomerLoginSync.SaveProfileAsync
async Task SaveProfileAsync(string slug, string name, string phone, string address, string email)
Definition
ShopCustomerLoginSync.cs:183
ShopPlatform.Services.ShopCustomerLoginSync._userContext
readonly ShopUserContext _userContext
Definition
ShopCustomerLoginSync.cs:23
ShopPlatform.Services.ShopCustomerProfileStore
Definition
ShopCustomerProfileStore.cs:15
ShopPlatform.Services.ShopCustomerSession
Definition
ShopCustomerSession.cs:14
ShopPlatform.Services.ShopUserContext
Definition
ShopUserContext.cs:51
Services
ShopCustomerLoginSync.cs
다음에 의해 생성됨 :
1.17.0