//[Route("geodatalov/{registername}/ny")] //[Route("geodatalov/{parentregister}/{registerowner}/{registername}/ny")] public ActionResult Create(GeodatalovDatasetViewModel viewModel, string parentregister, string registername, string metadataUuid) { viewModel.Register = _registerService.GetRegisterBySystemId(viewModel.RegisterId); if (!_accessControlService.Access(viewModel.Register)) { throw new HttpException(401, "Access Denied"); } if (viewModel.SearchString != null) { viewModel.SearchResultList = _metadataService.SearchMetadataFromKartkatalogen(viewModel.SearchString); return(View(viewModel)); } if (metadataUuid != null) { viewModel.Update(_metadataService.FetchGeodatalovDatasetFromKartkatalogen(metadataUuid)); if (viewModel.Name == null) { ModelState.AddModelError("ErrorMessage", "Det har oppstått en feil ved henting av metadata..."); } } if (!_registerItemService.ItemNameIsValid(viewModel)) { ModelState.AddModelError("ErrorMessage", HtmlHelperExtensions.ErrorMessageValidationDataset()); return(View(viewModel)); } if (!ModelState.IsValid) { return(View(viewModel)); } var inspireDataset = _geodatalovDatasetService.NewGeodatalovDataset(viewModel, parentregister, registername); return(Redirect(inspireDataset.Register.GetObjectUrl())); }
public GeodatalovDatasetViewModel NewGeodatalovDatasetViewModel(string parentregister, string registername) { var model = new GeodatalovDatasetViewModel() { RegisterId = _registerService.GetRegisterId(parentregister, registername) }; return(model); }
//[Route("geodatalov/{parentRegister}/{registerowner}/{registername}/{itemowner}/{itemname}/rediger")] //[Route("geodatalov/{registername}/{itemowner}/{itemname}/rediger")] public ActionResult Edit(GeodatalovDatasetViewModel viewModel) { if (ModelState.IsValid) { var geodatalovDataset = _geodatalovDatasetService.UpdateGeodatalovDataset(viewModel); return(Redirect(geodatalovDataset.DetailPageUrl())); } ViewBags(viewModel); return(View(viewModel)); }
private void GetDeliveryStatuses(GeodatalovDatasetViewModel geodatalovDatasetViewModel, GeodatalovDataset geodatalovDataset) { geodatalovDatasetViewModel.MetadataStatusId = _datasetDeliveryService.GetMetadataStatus(geodatalovDataset.Uuid, true, geodatalovDatasetViewModel.MetadataStatusId); geodatalovDatasetViewModel.ProductSpesificationStatusId = _registerService.GetDOKStatus(geodatalovDataset.ProductSpecificationUrl, true, geodatalovDatasetViewModel.ProductSpesificationStatusId); geodatalovDatasetViewModel.SosiDataStatusId = _registerService.GetSosiRequirements(geodatalovDataset.Uuid, geodatalovDatasetViewModel.ProductSpecificationUrl, true, geodatalovDatasetViewModel.SosiDataStatusId); geodatalovDatasetViewModel.GmlDataStatusId = _registerService.GetGmlRequirements(geodatalovDataset.Uuid, true, geodatalovDatasetViewModel.GmlDataStatusId); geodatalovDatasetViewModel.WmsStatusId = _datasetDeliveryService.GetDokDeliveryServiceStatus(geodatalovDataset.Uuid, true, geodatalovDatasetViewModel.WmsStatusId, geodatalovDataset.UuidService); geodatalovDatasetViewModel.WfsStatusId = _datasetDeliveryService.GetWfsStatus(geodatalovDataset.Uuid, true, geodatalovDatasetViewModel.WfsStatusId); geodatalovDatasetViewModel.AtomFeedStatusId = _datasetDeliveryService.GetAtomFeedStatus(geodatalovDataset.Uuid, true, geodatalovDatasetViewModel.AtomFeedStatusId); geodatalovDatasetViewModel.CommonStatusId = _datasetDeliveryService.GetDownloadRequirementsStatus(geodatalovDatasetViewModel.WfsStatusId, geodatalovDatasetViewModel.AtomFeedStatusId); }
public GeodatalovDataset NewGeodatalovDataset(GeodatalovDatasetViewModel geodatalovViewModel, string parentregister, string registername) { var geodatalovDataset = new GeodatalovDataset(); geodatalovDataset.SystemId = Guid.NewGuid(); geodatalovDataset.Name = geodatalovViewModel.Name; geodatalovDataset.Seoname = RegisterUrls.MakeSeoFriendlyString(geodatalovDataset.Name); geodatalovDataset.Description = geodatalovViewModel.Description; geodatalovDataset.SubmitterId = _registerService.GetOrganizationIdByUserName(); geodatalovDataset.OwnerId = geodatalovViewModel.OwnerId; geodatalovDataset.DateSubmitted = DateTime.Now; geodatalovDataset.Modified = DateTime.Now; geodatalovDataset.RegisterId = _registerService.GetRegisterId(parentregister, registername); geodatalovDataset.VersioningId = _registerItemService.NewVersioningGroup(geodatalovDataset); geodatalovDataset.VersionNumber = 1; geodatalovDataset.StatusId = "Submitted"; geodatalovDataset.Uuid = geodatalovViewModel.Uuid; geodatalovDataset.Notes = geodatalovViewModel.Notes; geodatalovDataset.SpecificUsage = geodatalovViewModel.SpecificUsage; geodatalovDataset.ProductSheetUrl = geodatalovViewModel.ProductSheetUrl; geodatalovDataset.PresentationRulesUrl = geodatalovViewModel.PresentationRulesUrl; geodatalovDataset.ProductSpecificationUrl = geodatalovViewModel.ProductSpecificationUrl; geodatalovDataset.MetadataUrl = geodatalovViewModel.MetadataUrl; geodatalovDataset.DistributionFormat = geodatalovViewModel.DistributionFormat; geodatalovDataset.DistributionUrl = geodatalovViewModel.DistributionUrl; geodatalovDataset.DistributionArea = geodatalovViewModel.DistributionArea; geodatalovDataset.WmsUrl = geodatalovViewModel.WmsUrl; geodatalovDataset.ThemeGroupId = geodatalovViewModel.ThemeGroupId; geodatalovDataset.DatasetThumbnail = geodatalovViewModel.DatasetThumbnail; geodatalovDataset.DokStatusId = "Proposal"; geodatalovDataset.UuidService = geodatalovViewModel.UuidService; GetDeliveryStatuses(geodatalovViewModel, geodatalovDataset); geodatalovDataset.InspireTheme = geodatalovViewModel.InspireTheme; geodatalovDataset.Dok = geodatalovViewModel.Dok; geodatalovDataset.NationalDataset = geodatalovViewModel.NationalDataset; geodatalovDataset.Plan = geodatalovViewModel.Plan; geodatalovDataset.Geodatalov = geodatalovViewModel.Geodatalov; geodatalovDataset.MetadataStatusId = _datasetDeliveryService.CreateDatasetDelivery(geodatalovViewModel.MetadataStatusId, geodatalovViewModel.MetadataNote); geodatalovDataset.ProductSpesificationStatusId = _datasetDeliveryService.CreateDatasetDelivery(geodatalovViewModel.WmsStatusId, geodatalovViewModel.WmsNote); geodatalovDataset.SosiDataStatusId = _datasetDeliveryService.CreateDatasetDelivery(geodatalovViewModel.WmsStatusId, geodatalovViewModel.WmsNote); geodatalovDataset.GmlDataStatusId = _datasetDeliveryService.CreateDatasetDelivery(geodatalovViewModel.WmsStatusId, geodatalovViewModel.WmsNote); geodatalovDataset.WmsStatusId = _datasetDeliveryService.CreateDatasetDelivery(geodatalovViewModel.WmsStatusId, geodatalovViewModel.WmsNote); geodatalovDataset.WfsStatusId = _datasetDeliveryService.CreateDatasetDelivery(geodatalovViewModel.WfsStatusId, geodatalovViewModel.WfsNote); geodatalovDataset.AtomFeedStatusId = _datasetDeliveryService.CreateDatasetDelivery(geodatalovViewModel.AtomFeedStatusId, geodatalovViewModel.AtomFeedNote); geodatalovDataset.CommonStatusId = _datasetDeliveryService.CreateDatasetDelivery(geodatalovViewModel.WmsStatusId, geodatalovViewModel.WmsNote); _dbContext.GeodatalovDatasets.Add(geodatalovDataset); _dbContext.SaveChanges(); return(geodatalovDataset); }
private void ViewBags(GeodatalovDatasetViewModel viewModel) { ViewBag.DokStatusId = _registerItemService.GetDokStatusSelectList(viewModel.DokStatusId); ViewBag.SubmitterId = _registerItemService.GetSubmitterSelectList(viewModel.SubmitterId); ViewBag.OwnerId = _registerItemService.GetOwnerSelectList(viewModel.OwnerId); ViewBag.MetadataStatusId = _datasetDeliveryService.GetDokDeliveryStatusesAsSelectlist(viewModel.MetadataStatusId); ViewBag.ProductSpesificationStatusId = _datasetDeliveryService.GetDokDeliveryStatusesAsSelectlist(viewModel.ProductSpesificationStatusId); ViewBag.SosiDataStatusId = _datasetDeliveryService.GetDokDeliveryStatusesAsSelectlist(viewModel.SosiDataStatusId); ViewBag.GmlDataStatusId = _datasetDeliveryService.GetDokDeliveryStatusesAsSelectlist(viewModel.GmlDataStatusId); ViewBag.WmsStatusId = _datasetDeliveryService.GetDokDeliveryStatusesAsSelectlist(viewModel.WmsStatusId); ViewBag.WfsStatusId = _datasetDeliveryService.GetDokDeliveryStatusesAsSelectlist(viewModel.WfsStatusId); ViewBag.AtomFeedStatusId = _datasetDeliveryService.GetDokDeliveryStatusesAsSelectlist(viewModel.AtomFeedStatusId); ViewBag.CommonStatusId = _datasetDeliveryService.GetDokDeliveryStatusesAsSelectlist(viewModel.CommonStatusId); }
//[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"); }
public GeodatalovDataset UpdateGeodatalovDataset(GeodatalovDatasetViewModel viewModel) { var geodatalovDataset = GetGeodatalovDatasetBySystemId(viewModel.SystemId); geodatalovDataset.Name = viewModel.Name; geodatalovDataset.Seoname = RegisterUrls.MakeSeoFriendlyString(geodatalovDataset.Name); geodatalovDataset.Description = viewModel.Description; geodatalovDataset.SubmitterId = viewModel.SubmitterId; geodatalovDataset.OwnerId = viewModel.OwnerId; geodatalovDataset.Modified = DateTime.Now; geodatalovDataset.DateSubmitted = DateTime.Now; geodatalovDataset.RegisterId = viewModel.RegisterId; geodatalovDataset.Uuid = viewModel.Uuid; geodatalovDataset.Notes = viewModel.Notes; geodatalovDataset.SpecificUsage = viewModel.SpecificUsage; geodatalovDataset.ProductSheetUrl = viewModel.ProductSheetUrl; geodatalovDataset.PresentationRulesUrl = viewModel.PresentationRulesUrl; geodatalovDataset.ProductSpecificationUrl = viewModel.ProductSpecificationUrl; geodatalovDataset.MetadataUrl = viewModel.MetadataUrl; geodatalovDataset.DistributionFormat = viewModel.DistributionFormat; geodatalovDataset.DistributionUrl = viewModel.DistributionUrl; geodatalovDataset.DistributionArea = viewModel.DistributionArea; geodatalovDataset.WmsUrl = viewModel.WmsUrl; geodatalovDataset.ThemeGroupId = viewModel.ThemeGroupId; geodatalovDataset.DatasetThumbnail = viewModel.DatasetThumbnail; geodatalovDataset.DokStatusId = viewModel.DokStatusId; geodatalovDataset.DokStatusDateAccepted = viewModel.GetDateAccepted(); geodatalovDataset.UuidService = viewModel.UuidService; if (geodatalovDataset.MetadataStatus != null) { geodatalovDataset.MetadataStatus.StatusId = viewModel.MetadataStatusId; geodatalovDataset.MetadataStatus.Note = viewModel.MetadataNote; geodatalovDataset.MetadataStatus.AutoUpdate = viewModel.MetadataAutoUpdate; } if (geodatalovDataset.ProductSpesificationStatus != null) { geodatalovDataset.ProductSpesificationStatus.StatusId = viewModel.ProductSpesificationStatusId; geodatalovDataset.ProductSpesificationStatus.Note = viewModel.ProduktspesifikasjonNote; geodatalovDataset.ProductSpesificationStatus.AutoUpdate = viewModel.ProduktspesifikasjonAutoUpdate; } if (geodatalovDataset.SosiDataStatus != null) { geodatalovDataset.SosiDataStatus.StatusId = viewModel.SosiDataStatusId; geodatalovDataset.SosiDataStatus.Note = viewModel.SosiDataNote; geodatalovDataset.SosiDataStatus.AutoUpdate = viewModel.SosiDataAutoUpdate; } if (geodatalovDataset.GmlDataStatus != null) { geodatalovDataset.GmlDataStatus.StatusId = viewModel.GmlDataStatusId; geodatalovDataset.GmlDataStatus.Note = viewModel.GmlDataNote; geodatalovDataset.GmlDataStatus.AutoUpdate = viewModel.GmlDataAutoUpdate; } if (geodatalovDataset.WmsStatus != null) { geodatalovDataset.WmsStatus.StatusId = viewModel.WmsStatusId; geodatalovDataset.WmsStatus.Note = viewModel.WmsNote; geodatalovDataset.WmsStatus.AutoUpdate = viewModel.WmsAutoUpdate; } if (geodatalovDataset.WfsStatus != null) { geodatalovDataset.WfsStatus.StatusId = viewModel.WfsStatusId; geodatalovDataset.WfsStatus.Note = viewModel.WfsNote; geodatalovDataset.WfsStatus.AutoUpdate = viewModel.WfsAutoUpdate; } if (geodatalovDataset.AtomFeedStatus != null) { geodatalovDataset.AtomFeedStatus.StatusId = viewModel.AtomFeedStatusId; geodatalovDataset.AtomFeedStatus.Note = viewModel.AtomFeedNote; geodatalovDataset.AtomFeedStatus.AutoUpdate = viewModel.AtomFeedAutoUpdate; } if (geodatalovDataset.CommonStatus != null) { geodatalovDataset.CommonStatus.StatusId = viewModel.CommonStatusId; geodatalovDataset.CommonStatus.Note = viewModel.CommonNote; geodatalovDataset.CommonStatus.AutoUpdate = viewModel.CommonAutoUpdate; } _dbContext.Entry(geodatalovDataset).State = EntityState.Modified; _dbContext.SaveChanges(); return(geodatalovDataset); }