コード例 #1
0
        public async Task OnGetAsync(string search, string searchType)
        {
            searchString = search;
            Statistic statistic = new Statistic()
            {
                Time = DateTime.Now, Route = search == null ? "NULL" : search.ToString(), Page = "Paper"
            };

            _context.Statistics.Add(statistic);
            await _context.SaveChangesAsync();

            //Paper = await _context.Papers
            //    .Include(p => p.Session).ToListAsync();
            var papers = from m in _context.Papers select m;

            //string[] searchs = search.Split(' ');
            if (!String.IsNullOrEmpty(searchType))
            {
                if (searchType.Contains("title"))
                {
                    if (!String.IsNullOrEmpty(search))
                    {
                        papers = papers.Where(s => s.Title.Contains(search) || s.Author.Contains(search));
                    }
                }
                else
                {
                    if (!String.IsNullOrEmpty(searchType))
                    {
                        papers = papers.Where(s => s.Abstract.Contains(search));
                    }
                }
            }
            Paper = await papers.Include(p => p.Session).OrderBy(m => m.TimeStart).ToListAsync();
        }
コード例 #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Paper).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PaperExists(Paper.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
コード例 #3
0
        public async Task OnGetAsync()
        {
            Statistic statistic = new Statistic()
            {
                Time = DateTime.Now, Route = "NULL", Page = "Location"
            };

            _context.Statistics.Add(statistic);
            await _context.SaveChangesAsync();
        }
コード例 #4
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Sections.Add(Session);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Create"));
        }
コード例 #5
0
        public async Task OnGetAsync()
        {
            Statistic statistic = new Statistic()
            {
                Time = DateTime.Now, Route = "NULL", Page = "Contact"
            };

            _context.Statistics.Add(statistic);
            await _context.SaveChangesAsync();

            Message = "Your contact page.";
        }
コード例 #6
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }


            _context.Papers.Add(Paper);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
コード例 #7
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Session = await _context.Sections.FindAsync(id);

            if (Session != null)
            {
                _context.Sections.Remove(Session);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
コード例 #8
0
        public async Task OnGetAsync(int?id, int?date, string type)
        {
            Statistic statistic = new Statistic()
            {
                Time = DateTime.Now, Route = id == null ? "NULL" : id.ToString() + "/" + date == null ? "DATE" : date.ToString(), Page = "Session"
            };

            _context.Statistics.Add(statistic);
            await _context.SaveChangesAsync();

            if (!String.IsNullOrEmpty(type))
            {
                if (type == "poster")
                {
                    if (date != null)
                    {
                        Session = await _context.Sections.Where(m => !m.IsBreak && m.TimeStart.Day == date && m.IsOral).ToListAsync();
                    }
                    else
                    {
                        Session = await _context.Sections.Where(m => !m.IsBreak && m.IsOral).ToListAsync();
                    }
                }
            }
            else
            {
                if (date != null)
                {
                    Session = await _context.Sections.Where(m => !m.IsBreak && m.TimeStart.Day == date).ToListAsync();
                }
                else
                {
                    Session = await _context.Sections.Where(m => !m.IsBreak).ToListAsync();
                }
            }



            if (id != null)
            {
                SessionID = id.Value;
                var papers = from m in _context.Papers.Where(m => m.SessionID == id.Value) select m;
                Papers = await papers.ToListAsync();
            }
        }
コード例 #9
0
        public async Task OnGetAsync(int?id)
        {
            Statistic statistic = new Statistic()
            {
                Time = DateTime.Now, Route = id == null ? "NULL":id.ToString(), Page = "Workshop"
            };

            _context.Statistics.Add(statistic);
            await _context.SaveChangesAsync();


            SessionsIQ = _context.Sections.Where(m => m.IsWorkshop).OrderBy(m => m.TimeStart);
            Session    = await SessionsIQ.AsNoTracking().ToListAsync();

            if (id != null)
            {
                SessionID = id.Value;
                var papers = from m in _context.Papers.Where(m => m.SessionID == id.Value) select m;
                Papers = await papers.ToListAsync();
            }
        }
コード例 #10
0
        public async Task OnGetAsync(int?id)
        {
            Statistic statistic = new Statistic()
            {
                Time = DateTime.Now, Route = id == null ? "NULL" : id.ToString(), Page = "Index"
            };

            _context.Statistics.Add(statistic);
            await _context.SaveChangesAsync();

            //Session = await _context.Sections.Where(m=>m.TimeStart.Day==DateTime.Now.Day).ToListAsync();
            int day = DateTime.Now.Day;

            SessionsIQ = _context.Sections.Where(m => m.TimeStart.Day == (day < 27?27: day)).OrderBy(m => m.TimeStart);
            Session    = await SessionsIQ.AsNoTracking().ToListAsync();

            if (id != null)
            {
                SessionID = id.Value;
                PapersIQ  = from m in _context.Papers.Where(m => m.SessionID == id.Value).OrderBy(m => m.TimeStart) select m;
                Papers    = await PapersIQ.AsNoTracking().ToListAsync();
            }
            //OnGoingPaper = await _context.Papers.Where(m => (m.TimeStart < DateTime.Now && m.TimeEnd > DateTime.Now)).ToListAsync();
        }
コード例 #11
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            Statistic statistic = new Statistic()
            {
                Time = DateTime.Now, Route = id == null ? "NULL" : id.ToString(), Page = "PaperDetails"
            };

            _context.Statistics.Add(statistic);
            await _context.SaveChangesAsync();

            if (id == null)
            {
                return(NotFound());
            }

            Paper = await _context.Papers
                    .Include(p => p.Session).FirstOrDefaultAsync(m => m.ID == id);

            if (Paper == null)
            {
                return(NotFound());
            }
            return(Page());
        }