Esempio n. 1
0
        public ActionResult ApplyLog()
        {
            DiaryListViewModel      dlvm = new DiaryListViewModel();
            AdministerBusinessLayer abl  = new AdministerBusinessLayer();

            dlvm.Diaries = DLVMSealed(abl.GetDiaryList());

            return(View("ApplyLog", dlvm));
        }
Esempio n. 2
0
 public DiaryListPage()
 {
     InitializeComponent();
     Init();
     DiaryListViewModel = new DiaryListViewModel(this)
     {
         Navigation = this.Navigation
     };
     this.BindingContext = DiaryListViewModel;
 }
Esempio n. 3
0
        //GET: InGame/Diary
        public async Task <IActionResult> Diary(int?page, int?filter, bool?datesort)
        {
            if (page == null)
            {
                page = 0;
            }
            if (datesort == null)
            {
                datesort = false;
            }
            if (filter == null || filter > 3)
            {
                filter = 0;
            }
            var game = await GameAsync();

            if (IsMaster(game))
            {
                ViewData["IsMaster"] = "true";
                ViewData["Id"]       = game.Id;
            }
            ViewData["Title"] = game.Name;
            var character = await _context.Characters
                            .AsNoTracking()
                            .FirstOrDefaultAsync(d => d.GameId == (Guid)GameId() && d.UserId == UserId());

            if (character == null)
            {
                return(View("NoCharacter"));
            }
            IQueryable <DiaryPage> source = _context.Diary
                                            .AsNoTracking()
                                            .Where(d => d.CharacterId == character.Id);
            var diaryType = (DiaryFilter)filter;

            switch ((DiaryFilter)filter)
            {
            case DiaryFilter.All:  break;

            case DiaryFilter.Master: source = source.Where(p => p.Type == DiaryPageType.Master); break;

            case DiaryFilter.Player: source = source.Where(p => p.Type == DiaryPageType.User); break;

            case DiaryFilter.System: source = source.Where(p => p.Type == DiaryPageType.Signal); break;
            }
            var count = await source.CountAsync();

            IEnumerable <DiaryPage> items = await source.Skip((int)page *pagesPerSheet).Take(pagesPerSheet).ToListAsync();

            DiaryListViewModel pageViewModel = new DiaryListViewModel(items, count, pagesPerSheet, (int)page, (bool)datesort, diaryType);

            return(View(pageViewModel));
        }
Esempio n. 4
0
        private void LoadDiaries()
        {
            ObservableCollection <Diary> diaries =
                new ObservableCollection <Diary>
            {
                new Diary
                {
                    Date    = "2018-11-11",
                    Weather = "晴",
                    Content = "阴"
                }
            };

            diaryListViewModel =
                new DiaryListViewModel(diaries);
        }