//[Route("kodeliste/{parentregister}/{registerowner}/{registername}/{itemowner}/{itemname}/rediger")] //[Route("kodeliste/{registername}/{itemowner}/{itemname}/rediger")] public ActionResult Edit(CodelistValue codelistValue, string itemowner, string registername, string itemname, string parentregister, List <Guid> narrower, Guid?broader, string registerowner) { var originalCodelistValue = (CodelistValue)_registerItemService.GetRegisterItem(parentregister, registername, itemname, null); if (originalCodelistValue != null) { if (_accessControlService.HasAccessTo(originalCodelistValue)) { if (ModelState.IsValid) { codelistValue.register = _registerService.GetRegisterBySystemId(codelistValue.registerId); InitialisationCodelistValue(codelistValue, narrower, broader, originalCodelistValue); if (!NameIsValid(codelistValue)) { ModelState.AddModelError("ErrorMessage", HtmlHelperExtensions.ErrorMessageValidationName()); Viewbags(originalCodelistValue); return(View(originalCodelistValue)); } _registerItemService.SaveEditedRegisterItem(originalCodelistValue); return(Redirect("/" + originalCodelistValue.register.path + "/" + originalCodelistValue.seoname + "/" + originalCodelistValue.systemId)); //return Redirect(RegisterUrls.DeatilsRegisterItemUrl(parentregister, registerowner, registername, itemowner, originalCodelistValue.seoname)); } } else { throw new HttpException(401, "Access Denied"); } } Viewbags(originalCodelistValue); return(View(originalCodelistValue)); }
//[Route("epsg/{parentRegister}/{registerowner}/{registername}/ny")] //[Route("epsg/{registername}/ny")] public ActionResult Create(EPSG epsgKode, string registername, string parentRegister, string registerowner) { epsgKode.register = _registerService.GetRegister(parentRegister, registername); if (epsgKode.register != null) { if (_accessControlService.Access(epsgKode.register)) { if (ModelState.IsValid) { initialisationEPSG(epsgKode); if (!NameIsValid(epsgKode)) { ModelState.AddModelError("ErrorMessage", HtmlHelperExtensions.ErrorMessageValidationName()); ViewBag.dimensionId = new SelectList(db.Dimensions.ToList().Select(s => new { value = s.value, description = s.DescriptionTranslated() }).OrderBy(s => s.description), "value", "description", string.Empty); return(View(epsgKode)); } _registerItemService.SaveNewRegisterItem(epsgKode); return(Redirect(RegisterUrls.DeatilsRegisterItemUrl(parentRegister, registerowner, registername, epsgKode.submitter.seoname, epsgKode.seoname))); } else { throw new HttpException(401, "Access Denied"); } } } ViewBag.dimensionId = new SelectList(db.Dimensions.ToList().Select(s => new { value = s.value, description = s.DescriptionTranslated() }).OrderBy(s => s.description), "value", "description", string.Empty); return(View(epsgKode)); }
//[Route("kodeliste/{parentregister}/{registerowner}/{registername}/ny")] //[Route("kodeliste/{registername}/ny")] public ActionResult Create(CodelistValue codelistValue, string registername, string parentregister, string parentRegisterId, string registerowner, List <Guid> narrower, Guid?broader) { codelistValue.register = _registerService.GetRegisterBySystemId(Guid.Parse(parentRegisterId)); if (codelistValue.register != null) { codelistValue.registerId = codelistValue.register.systemId; if (_accessControlService.HasAccessTo(codelistValue.register)) { if (!_registerItemService.ItemNameIsValid(codelistValue)) { ModelState.AddModelError("ErrorMessage", HtmlHelperExtensions.ErrorMessageValidationName()); return(View(codelistValue)); } if (ModelState.IsValid) { codelistValue.submitter = _registerService.GetOrganizationByUserName(); codelistValue.InitializeNewCodelistValue(codelistValue.register.TransliterNorwegian); codelistValue.versioningId = _registerItemService.NewVersioningGroup(codelistValue); SetBroaderAndNarrowerItems(codelistValue, narrower, broader); _registerItemService.SaveNewRegisterItem(codelistValue); return(Redirect(codelistValue.GetObjectUrl())); } } } ViewBag.broaderItemsList = _registerItemService.GetBroaderItems(); return(View(codelistValue)); }
//[Route("dokument/{parentregister}/{registerowner}/{registername}/{itemowner}/{documentname}/rediger")] //[Route("dokument/{registername}/{itemowner}/{documentname}/rediger")] public ActionResult Edit(Document document, string parentregister, string registerowner, string registername, string itemowner, string documentname, HttpPostedFileBase documentfile, HttpPostedFileBase thumbnail, bool retired, bool sosi) { var originalDocument = (Document)_registerItemService.GetRegisterItem(parentregister, registername, documentname, document.versionNumber); if (originalDocument != null) { if (!_registerItemService.ItemNameIsValid(document)) { ModelState.AddModelError("ErrorMessage", HtmlHelperExtensions.ErrorMessageValidationName()); } else if (ModelState.IsValid) { originalDocument = _documentService.UpdateDocument(originalDocument, document, documentfile, thumbnail, retired, sosi); var url = System.Web.Configuration.WebConfigurationManager.AppSettings["RegistryUrl"] + "data/" + Document.DataDirectory; document.documentUrl = documentUrl(url, documentfile, document.documentUrl, document.name, originalDocument.register.name, document.versionNumber); document.thumbnail = GetThumbnail(document, documentfile, url, thumbnail); //document = initialisationDocument(document, documentfile, thumbnail, retired, sosi, originalDocument); return(Redirect(originalDocument.GetObjectUrl())); } } Viewbags(document); return(View(originalDocument)); }
//[Route("organisasjoner/{parentRegister}/{registerowner}/{registername}/ny")] //[Route("organisasjoner/{registername}/ny")] public ActionResult Create(Organization organization, HttpPostedFileBase fileSmal, HttpPostedFileBase fileLarge, string registername, string parentRegister, HttpPostedFileBase agreementDocument, HttpPostedFileBase priceformDocument, string registerOwner) { organization.register = _registerService.GetRegister(parentRegister, registername); if (organization.register != null) { if (_accessControlService.Access(organization.register)) { if (ModelState.IsValid) { InitializeOrganization(organization, fileSmal, fileLarge, agreementDocument, priceformDocument); if (!NameIsValid(organization)) { ModelState.AddModelError("ErrorMessage", HtmlHelperExtensions.ErrorMessageValidationName()); return(View(organization)); } _registerItemService.SaveNewRegisterItem(organization); return(Redirect(RegisterUrls.DeatilsRegisterItemUrl(parentRegister, registerOwner, registername, organization.submitter.seoname, organization.seoname))); } else { throw new HttpException(401, "Access Denied"); } } } return(View(organization)); }
private ActionResult EditDataset(Dataset dataset, Dataset originalDataset, CoverageDataset coverage = null) { dataset.register = originalDataset.register; if (!NameIsValid(dataset)) { ModelState.AddModelError("ErrorMessage", HtmlHelperExtensions.ErrorMessageValidationName()); Viewbags(originalDataset); return(View(originalDataset)); } dataset = _datasetService.UpdateDataset(dataset, originalDataset, coverage); _translationService.UpdateTranslations(dataset, originalDataset); _registerItemService.SaveEditedRegisterItem(originalDataset); return(Redirect(originalDataset.GetObjectUrl())); }
//[Route("dokument/{parentRegister}/{registerowner}/{registername}/ny")] //[Route("dokument/{registername}/ny")] public ActionResult Create(Document document, HttpPostedFileBase documentfile, HttpPostedFileBase thumbnail, string registername, string parentRegister, string registerowner) { document.register = _registerService.GetRegister(parentRegister, registername); if (_accessControlService.Access(document.register)) { if (!NameIsValid(document)) { ModelState.AddModelError("ErrorMessage", HtmlHelperExtensions.ErrorMessageValidationName()); } else if (ModelState.IsValid) { document = initialisationDocument(document, documentfile, thumbnail); return(Redirect(document.GetObjectUrl())); } } return(View(document)); }