Beispiel #1
0
        public async Task <CommunityUserViewModel> GetCommunitiesAsync()
        {
            var value = HttpContext.Current.User.Identity.Name;

            var a = System.DateTime.Now;

            CommunityUserViewModel abc = new CommunityUserViewModel();

            abc.Com = await _db.Communities.Where(c => c.CommunityAdmin == value).ToListAsync();

            abc.appuser = await _db.Users.Where(u => u.UserName.Equals(value)).FirstOrDefaultAsync();

            //abc.fcom = await _db.FormsCommunity.Where(u => u.QForms.FormOwner.Equals(value)).ToListAsync();
            var active_fom = await _db.FormsCommunity.Where(u => u.QForms.FormOwner.Equals(value) && u.QForms.Expiry_Time > a).ToListAsync();

            var sealed_fom = await _db.FormsCommunity.Where(u => u.QForms.FormOwner.Equals(value) && u.QForms.Expiry_Time < a).ToListAsync();

            int Tform = active_fom.Count + sealed_fom.Count;

            abc.active_fom = active_fom;
            abc.sealed_fom = sealed_fom;
            abc.Tform      = Tform;
            //abc.qf = await _db.QForms.Where(u => u.FormOwner.Equals(value)).ToListAsync();

            //abc.activeform = await (from c in _db.QForms where c.FormOwner == value && c.Expiry_Time > a select c).CountAsync();

            //abc.sealedform = await (from c in _db.QForms where c.FormOwner == value && c.Expiry_Time < a select c).CountAsync();


            return(abc);
        }
Beispiel #2
0
        // GET: Messages, gets last logged in and un read messages and also updates last logged in
        public async Task <IActionResult> Index()
        {
            CommunityUserViewModel vm = new CommunityUserViewModel();

            vm.lastLoggedIn   = CommunityUser.getLastLoggedIn(_userManager.GetUserId(User), _context2);
            vm.messagesUnread = await Message.getNrOfUnreadMessagesAsync(_userManager.GetUserId(User), _context);

            return(await Index(vm));
        }
Beispiel #3
0
        public async Task <IActionResult> Index(CommunityUserViewModel vm)
        {
            await CommunityUser.setLastLoggedInAsync(_userManager.GetUserId(User), _context2);

            return(View(vm));
        }