//[Route("dok/kommunalt/{municipalityCode}/rediger")] public ActionResult EditDokMunicipal(string municipalityCode) { if (_accessControlService.AccessEditOrCreateDOKMunicipalBySelectedMunicipality(municipalityCode)) { var municipality = _registerItemService.GetMunicipalityOrganizationByNr(municipalityCode); Models.Register dokMunicipalRegister = _registerService.GetDokMunicipalRegister(); var municipalDatasets = _registerService.GetDatasetBySelectedMunicipality(dokMunicipalRegister, municipality); if (municipality != null) { var dokMunicipalEditList = new List <DokMunicipalEdit>(); foreach (Dataset dataset in municipalDatasets) { var row = new DokMunicipalEdit(dataset, municipality); dokMunicipalEditList.Add(row); } ViewBag.selectedMunicipality = municipality.name; ViewBag.selectedMunicipalityCode = municipalityCode; var statusDokMunicipalList = CreateStatusDokMunicipalList(); ViewBag.statusDOKMunicipal = new SelectList(statusDokMunicipalList, "value", "description", DOKmunicipalStatus(municipality)); return(View(dokMunicipalEditList)); } else { return(HttpNotFound()); } } return(HttpNotFound()); }
//[Route("dataset/{parentRegister}/{registerowner}/{registername}/{municipality}/ny")] //[Route("dataset/{registername}/{municipality}/ny")] public ActionResult CreateMunicipalDataset(string municipality) { if (municipality != null) { CreateDokMunicipalViewModel model = new CreateDokMunicipalViewModel(); model.Register = _registerService.GetDokMunicipalRegister(); model.MunicipalityCode = municipality; model.DatasetOwner = _registerItemService.GetMunicipalityOrganizationByNr(municipality); if (_accessControlService.AccessEditOrCreateDOKMunicipalBySelectedMunicipality(model.MunicipalityCode)) { return(View(model)); } else { throw new HttpException(401, "Access Denied"); } } return(HttpNotFound("Finner ikke kommunenr.")); }
public static bool AccessEditDokMunicipalBySelectedMunicipality(string selectedMunicipalityCode) { return(AccessControl.AccessEditOrCreateDOKMunicipalBySelectedMunicipality(selectedMunicipalityCode)); }