예제 #1
0
        public async Task <bool> Login(int clientId, int password)
        {
            Client client = await AuthService.Login(clientId, password);

            if (client != null)
            {
                Session session = new Session()
                {
                    ClientId  = client.ClientId,
                    StartDate = DateTime.Now
                };

                using (DataManagementProvider)
                {
                    await DataManagementProvider.Upsert(client);

                    await DataManagementProvider.Insert(session);

                    await DataManagementProvider.SaveAsync();
                }

                CurrentSession = session;

                return(true);
            }

            return(false);
        }
예제 #2
0
        public async Task LogUserAction(string description)
        {
            var userAction = new UserAction()
            {
                SessionId   = AuthProvider.CurrentSession.SessionId,
                Description = description,
                Date        = DateTime.Now
            };

            using (DataManagementProvider)
            {
                await DataManagementProvider.Insert(userAction);

                await DataManagementProvider.SaveAsync();
            }
        }