public async System.Threading.Tasks.Task <IViewComponentResult> InvokeAsync(short?teamId)
        {
            var socialNetwork = teamId != null ?
                                await _socialNetworkService.GetAll().AsNoTracking().Where(s => s.TeamId == teamId).ToListAsync()
                : await _socialNetworkService.GetAll().AsNoTracking().Where(s => s.SiteSettingId != null).ToListAsync();

            var model = new Tuple <List <SocialNetwork>, short?>(socialNetwork, teamId);

            return(View(model));
        }
Beispiel #2
0
        public async Task <IActionResult> DeleteSocialNetwork(short id)
        {
            var socialNetwork = await _socialNetworkService.GetAll().AsNoTracking().FirstOrDefaultAsync(s => s.Id == id);

            var result = false;

            try
            {
                await _socialNetworkService.Delete(socialNetwork);

                result = true;
            }
            catch { }
            return(new JsonResult(new
            {
                result = result
            }));
        }
        public async System.Threading.Tasks.Task <IViewComponentResult> InvokeAsync(short?teamId, short id)
        {
            var socialNetwork = new SocialNetwork();

            if (id != 0)
            {
                socialNetwork = await _socialNetworkService.GetAll().AsNoTracking().FirstOrDefaultAsync(u => u.Id == id);
            }
            else if (teamId != null)
            {
                socialNetwork.TeamId = teamId;
            }
            return(View(socialNetwork));
        }
Beispiel #4
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var socialBetwork = await _socialNetworkService.GetAll().AsNoTracking().Where(sn => sn.TeamId == null).ToListAsync();

            var siteSetting = await _siteSettingService.GetAll().AsNoTracking().Include(s => s.SiteLogo).FirstOrDefaultAsync();

            if (socialBetwork == null)
            {
                socialBetwork = new List <SocialNetwork>();
            }

            var model = new Tuple <List <SocialNetwork>, SiteSetting>(socialBetwork, siteSetting);

            return(View(model));
        }
Beispiel #5
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var socialNetworks = await _socialNetworkService.GetAll().AsNoTracking().Where(c => c.TeamId == null).ToListAsync();

            return(View(socialNetworks));
        }