Exemplo n.º 1
0
        public IActionResult Index()
        {
            ClaimsPrincipal user = new ClaimsPrincipal();

            try
            {
                user = User;
            }
            catch (NullReferenceException)
            {
                ViewBag.ErrorMessage = "No logged in user could be found.";
                return(View());
            }
            Registrator registrator = Registrator.GetRegistratorData(user);

            registrator = _iRegTempus.GetRegistratorBasedOnUserId(registrator);
            bool result = ((registrator == null) ? false : true);

            if (result == false)
            {
                registrator = Registrator.GetRegistratorData(user);
                registrator.UserHaveStartedTimeMeasure = false;
                registrator.StartedTimeMeasurement     = 0;
                registrator = _iRegTempus.CreateRegistrator(registrator);
            }
            UserTimeRegistrationViewModel konvertedRegistrator = UserTimeRegistrationViewModel.RestructureTheRegistratorData(registrator);

            return(View(konvertedRegistrator));
        }