コード例 #1
0
        //[Route("dataset/{parentRegister}/{registerowner}/{registername}/{itemowner}/{itemname}/rediger")]
        //[Route("dataset/{registername}/{itemowner}/{itemname}/rediger")]
        public ActionResult Edit(Dataset dataset, CoverageDataset coverage, string registername, string itemname, string metadataUuid, string parentRegister, string registerowner, string itemowner, bool dontUpdateDescription = false)
        {
            Dataset originalDataset = (Dataset)_registerItemService.GetRegisterItem(parentRegister, registername, itemname, 1, itemowner);

            if (originalDataset != null)
            {
                if (metadataUuid != null)
                {
                    Dataset model = GetMetadataFromKartkatalogen(originalDataset, metadataUuid, dontUpdateDescription);
                    Viewbags(model);
                    return(View(model));
                }

                if (originalDataset.IsNationalDataset())
                {
                    if (_accessControlService.IsAdmin())
                    {
                        return(EditDataset(dataset, originalDataset));
                    }
                    if (_accessControlService.IsMunicipalUser())
                    {
                        return(EditCoverageDataset(coverage, originalDataset));
                    }
                }
                else if (_accessControlService.Access(originalDataset))
                {
                    if (ModelState.IsValid)
                    {
                        return(EditDataset(dataset, originalDataset, coverage));
                    }
                }
                else
                {
                    throw new HttpException(401, "Access Denied");
                }
            }
            Viewbags(originalDataset);
            return(View(originalDataset));
        }