// GET: RegisterEntry
        public ActionResult RegisterEntryView()
        {
            ViewBag.Title = "Registrera mätarställning";
            ViewBag.SubTitle = "Registrera aktuell mätarställning";
            ViewBag.Action = "Registrera";

            var model = new RegisterEntryModel
            {
                DateString = DateTime.Now.ToShortDateString(),
                RegisterValue = string.Empty,
            };

            return View(model);
        }
        public ActionResult SubmitRegisterEntry(RegisterEntryModel model)
        {
            try
            {
                bool ok;
                DateTime t;
                int v;
                ok = DateTime.TryParse(model.DateString, out t);
                if (!ok)
                {
                    ViewBag.Title = "Fel vid registrering";
                    ViewBag.SubTitle = "Datum kunde ej tolkas";
                    return View(model);
                } // TODO better error handling

                ok = int.TryParse(model.RegisterValue, out v);
                if (!ok)
                {
                    ViewBag.Title = "Fel vid registrering";
                    ViewBag.SubTitle = "Mätarställning kunde ej tolkas";
                    return View(model);
                } // TODO better error handling

                var now = DateTime.Now;
                var isToday =
                    t.Year == now.Year
                    && t.Month == now.Month
                    && t.Day == now.Day;
                if (isToday)
                {
                    t = now;
                }

                var tvq = new Tvq(t, v, Quality.Ok);

                var repo = new RegistryEntryRepoFactory().GetRegistryEntryRepo();
                repo.AddRegistryEntry(tvq);
                ViewBag.Title = "Mätarställning registrerad";
                ViewBag.SubTitle = "Mätarställningen blev registrerad";
                return View(model);
            }
            catch (Exception e)
            {
                _logger.TrackException(e);
                ViewBag.Title = "Ett fel uppstod";
                ViewBag.SubTitle = "Ett fel uppstod vid registrering av mätarställning";
                return View(model);
            }
        }