Beispiel #1
0
        //[Route("geodatalov/{parentRegister}/{registerowner}/{registername}/{itemowner}/{itemname}/rediger")]
        //[Route("geodatalov/{registername}/{itemowner}/{itemname}/rediger")]
        public ActionResult Edit(string registername, string itemname)
        {
            var geodatalovDataset = _geodatalovDatasetService.GetGeodatalovDatasetByName(registername, itemname);

            if (geodatalovDataset == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (_accessControlService.Access(geodatalovDataset))
            {
                geodatalovDataset = _geodatalovDatasetService.UpdateGeodatalovDatasetFromKartkatalogen(geodatalovDataset);
                var viewModel = new GeodatalovDatasetViewModel(geodatalovDataset);
                ViewBags(viewModel);
                return(View(viewModel));
            }
            throw new HttpException(401, "Access Denied");
        }
        private RegisterItemV2ViewModel GetRegisterItemByName(string parentregister, string registername, string itemowner, string itemname, string inspireRegistryType, int version = 1)
        {
            var register = _registerService.GetRegister(parentregister, registername);

            if (register.IsInspireStatusRegister())
            {
                RegisterItemV2ViewModel viewModel = null;
                if (string.IsNullOrWhiteSpace(inspireRegistryType) || inspireRegistryType == "dataset")
                {
                    var inspireDataset = _inspireDatasetService.GetInspireDatasetByName(registername, itemname);
                    if (inspireDataset != null)
                    {
                        viewModel = new InspireDatasetViewModel(inspireDataset);
                    }
                    else
                    {
                        viewModel = new InspireDataServiceViewModel(_inspireDatasetService.GetInspireDataServiceByName(registername, itemname));
                    }
                }
                else
                {
                    viewModel = new InspireDataServiceViewModel(_inspireDatasetService.GetInspireDataServiceByName(registername, itemname));
                }
                return(viewModel);
            }
            if (register.IsGeodatalovStatusRegister())
            {
                return(new GeodatalovDatasetViewModel(_geodatalovDatasetService.GetGeodatalovDatasetByName(registername, itemname)));
            }
            if (register.IsDokMunicipal())
            {
                return(new RegisterItemV2ViewModel(_registerItemService.GetRegisterItem(parentregister, registername, itemname, version, itemowner)));
            }

            if (register.ContainedItemClassIsDataset())
            {
                return(new DokDatasetViewModel((Dataset)_registerItemService.GetRegisterItem(parentregister, registername, itemname, version, itemowner)));
            }
            if (register.ContainedItemClassIsDocument())
            {
                return(new DocumentViewModel((Document)_registerItemService.GetRegisterItem(parentregister, registername, itemname, version, itemowner)));
            }

            return(new RegisterItemV2ViewModel(_registerItemService.GetRegisterItem(parentregister, registername, itemname, version, itemowner)));
        }