public ActionResult List(string taxonId) { int revisionId = this.RevisionId.Value; if (taxonId.IsNull()) { taxonId = this.TaxonIdentifier.Id.ToString(); } TaxonSearchResult searchResult = this.TaxonSearchManager.GetTaxon(taxonId); if (searchResult.NumberOfMatches != 1) { return(RedirectToSearch(taxonId, new { revisionId = revisionId })); } this.TaxonIdentifier = TaxonIdTuple.Create(taxonId, searchResult.Taxon.Id); ITaxon taxon = searchResult.Taxon; ViewBag.Taxon = taxon; //this.NavigateData = new NavigateData("TaxonName", "List"); var model = new ListTaxonNameViewModel(taxon, this.TaxonRevision); return(View("List", model)); }
public ActionResult List(string[] isNotOkForObs, string[] isRecommended) { ITaxon taxon = TaxonSearchManager.GetTaxonById(TaxonIdentifier.Id.Value); var model = new ListTaxonNameViewModel(taxon, this.TaxonRevision); //todo change revisionId ValidateTaxon(GetCurrentUser(), taxon.Id); TaxonNameList changedTaxonNames = model.GetChangedTaxonNames(isNotOkForObs, isRecommended); // Only usage: Accepted may have Recommended: Yes. foreach (ITaxonName taxonName in changedTaxonNames) { if (taxonName.IsRecommended && taxonName.NameUsage.Id != (int)TaxonNameUsageId.Accepted) { ModelState.AddModelError("", Resources.DyntaxaResource.TaxonNameListWrongNameUsage); break; } } if (ModelState.IsValid) { if (changedTaxonNames.Count > 0) { IUserContext loggedInUser = GetLoggedInUser(); using (ITransaction transaction = loggedInUser.StartTransaction()) { CoreData.TaxonManager.UpdateTaxonNames(loggedInUser, this.TaxonRevision, changedTaxonNames); transaction.Commit(); } } RedrawTree(); return(RedirectToAction("List")); } ViewBag.Taxon = taxon; return(View(model)); }