public Sesi GetLastSession(string userId)
        {
            Sesi obj = null;

            using (IDbContext context = new DbContext())
            {
                _repository = new SesiRepository(context);
                obj         = _repository.GetLastSession(userId);
            }

            return(obj);
        }
        public int Update(Sesi obj)
        {
            var result = 0;

            using (IDbContext context = new DbContext())
            {
                _repository = new SesiRepository(context);
                result      = _repository.Update(obj);
            }

            return(result);
        }
Beispiel #3
0
        private Sesi SaveSession(string userId)
        {
            var obj = new Sesi
            {
                user_id = userId
            };

            ISesiController controller = new SesiController();
            var             result     = controller.Save(obj);

            return(obj);
        }
        public int Update(Sesi obj)
        {
            var result = 0;

            try
            {
                result = _context.Db.Update <Sesi>(obj) ? 1 : 0;
            }
            catch (Exception ex)
            {
                //_log.Error("Error:", ex);
            }

            return(result);
        }
        public int Save(Sesi obj)
        {
            var result = 0;

            try
            {
                _context.Db.Insert <Sesi>(obj);
                result = 1;
            }
            catch (Exception ex)
            {
                //_log.Error("Error:", ex);
            }

            return(result);
        }
        public Sesi GetLastSession(string userId)
        {
            Sesi obj = null;

            try
            {
                var sql = @"select * from sesi 
                            where user_id = @userId and is_timeout = 0
                            order by sesi_id desc 
                            limit 1";
                obj = _context.Db.QuerySingleOrDefault <Sesi>(sql, new { userId });
            }
            catch (Exception ex)
            {
                //_log.Error("Error:", ex);
            }

            return(obj);
        }
 public int Delete(Sesi obj)
 {
     throw new NotImplementedException();
 }
Beispiel #8
0
 private void SetTimeout(Sesi obj)
 {
     ISesiController controller = new SesiController();
     var             result     = controller.Update(obj);
 }