public ActionResult Index()
        {
            var model = new IndexViewModels
            {
                Languages =
                {
                    CurrentCount = langService.GetByActiveProject(UserActiveProject).Count(),
                    ActiveCount  = langService.GetActiveByActiveProject(UserActiveProject).Count()
                },
                Contexts =
                {
                    CurrentCount =
                        phrsContService.GetAllByIdProject(UserActiveProject, User.Identity.GetUserId()).Count(),
                    Translated   =
                        phrsContService.GetTranslatedByIdProject(UserActiveProject, User.Identity.GetUserId()).Count()
                },
                Projects           = { ProjectCount = projectServices.GetForUser(User.Identity.GetUserId()).Count() },
                SystemStabilityBox = GetSystemStabilityLoggsViewModel(),
                BearerToken        = tokenContainer.ApiToken?.ToString()
            };



            SetViewBagsAndHeaders(Request.IsAjaxRequest(), "Dashboard", "Hello! This is your administration panel.");
            if (Request.IsAjaxRequest())
            {
                return(PartialView(model));
            }

            return(View(model));
        }
        // GET: Sections
        public async Task <ActionResult> FirstRow(string id)
        {
            if (id == "Home" || id == "")
            {
                var model = new HomeFirstRowSectionViewModel();
                //model.BearerToken = tokenContainer?.ApiToken.ToString();
                return(PartialView("HomeFirstRowSection", model));
            }
            if (id == "Resources")
            {
                var model = new ResourcesFirstRowSectionViewModel();
                model.Languages.CurrentCount = langService.GetByActiveProject(UserActiveProject).Count();
                model.Languages.ActiveCount  = langService.GetActiveByActiveProject(UserActiveProject).Count();

                model.Contexts.CurrentCount = phrsContService.GetAllByIdProject(UserActiveProject, User.Identity.GetUserId()).Count();
                model.Contexts.Translated   = phrsContService.GetTranslatedByIdProject(UserActiveProject, User.Identity.GetUserId()).Count();

                model.Projects.ProjectCount = projectServices.GetForUser(User.Identity.GetUserId()).Count();
                return(PartialView("ResourcesFirstRowSection", model));
            }

            if (id == "Contexts")
            {
                var model = new ContextsFirstRowSectionViewModel();
                model.Languages.CurrentCount = langService.GetByActiveProject(UserActiveProject).Count();
                model.Languages.ActiveCount  = langService.GetActiveByActiveProject(UserActiveProject).Count();

                model.Projects.ProjectCount = projectServices.GetForUser(User.Identity.GetUserId()).Count();

                return(PartialView("ContextsFirstRowSection", model));
            }

            if (id == "Languages")
            {
                var model = new CurrentProjectInfoBoxViewModel();
                model.ProjectCount = projectServices.GetForUser(User.Identity.GetUserId()).Count();
                return(PartialView("InnerPartials/CurrentProjectInfoBox", model));
            }
            return(PartialView("Default"));
        }
예제 #3
0
        public ActionResult Index()
        {
            var model = languagesService.GetByActiveProject(UserActiveProject).ProjectTo <LanguagesViewModels>();

            SetViewBagsAndHeaders(Request.IsAjaxRequest(), "All added languages", "You can choose wich language to be active or add new one.");
            if (Request.IsAjaxRequest())
            {
                return(PartialView(model));
            }

            return(View(model));
        }