public static void SignOut() { MvcContext.Current.PassportId = 0; MvcContext.Current.UserPassport = null; MvcContext.Current.ClientAccount = null; var deviceKey = HttpContext.Current.Request.Headers[DeviceKey]; var deviceId = 0L; if (false == string.IsNullOrEmpty(deviceKey) && false == long.TryParse(deviceKey, out deviceId) && deviceId > 0) { var account = AnonymousAccount.CreateNew(deviceId); MvcContext.Current.ClientAccount = account; } }
public static AnonymousAccount CreateNew(ClientDevice device) { if (null == device) { return(null); } device.DeviceId = 0; device.CreatedTime = DateTime.Now; device.ModifiedTime = device.CreatedTime; device.Save(); var account = AnonymousAccount.CreateNew(device.DeviceId); return(account); }