public ActionResult DeleteConfirmed(int id)
        {
            vocabulary vocabulary = db.vocabularies.Find(id);

            db.vocabularies.Remove(vocabulary);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // GET: /vocabulary/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            vocabulary vocabulary = db.vocabularies.Find(id);

            if (vocabulary == null)
            {
                return(HttpNotFound());
            }
            return(View(vocabulary));
        }
        private object[] ExportConstraints(TemplateConstraint parentConstraint = null, bool isAttribute = false)
        {
            List <object> constraintRules = new List <object>();

            if (parentConstraint != null)
            {
                if (parentConstraint.ValueSet != null || parentConstraint.CodeSystem != null || !string.IsNullOrEmpty(parentConstraint.Value))
                {
                    vocabulary vocabConstraint = new vocabulary();

                    if (parentConstraint.ValueSet != null)
                    {
                        vocabConstraint.valueSet = parentConstraint.ValueSet.Oid;

                        string oid, ext;

                        if (IdentifierHelper.IsIdentifierOID(parentConstraint.ValueSet.Oid))
                        {
                            IdentifierHelper.GetIdentifierOID(parentConstraint.ValueSet.Oid, out oid);
                            vocabConstraint.valueSet = oid;
                        }
                        else if (IdentifierHelper.IsIdentifierII(parentConstraint.ValueSet.Oid))
                        {
                            IdentifierHelper.GetIdentifierII(parentConstraint.ValueSet.Oid, out oid, out ext);
                            vocabConstraint.valueSet = oid;
                        }
                    }

                    if (parentConstraint.CodeSystem != null)
                    {
                        vocabConstraint.codeSystem     = parentConstraint.CodeSystem.Oid;
                        vocabConstraint.codeSystemName = parentConstraint.CodeSystem.Name;

                        string oid, ext;

                        if (IdentifierHelper.IsIdentifierOID(parentConstraint.CodeSystem.Oid))
                        {
                            IdentifierHelper.GetIdentifierOID(parentConstraint.CodeSystem.Oid, out oid);
                            vocabConstraint.codeSystem = oid;
                        }
                        else if (IdentifierHelper.IsIdentifierII(parentConstraint.CodeSystem.Oid))
                        {
                            IdentifierHelper.GetIdentifierII(parentConstraint.CodeSystem.Oid, out oid, out ext);
                            vocabConstraint.codeSystem = oid;
                        }
                    }

                    if (!string.IsNullOrEmpty(parentConstraint.Value))
                    {
                        vocabConstraint.code = parentConstraint.Value;
                    }

                    if (!string.IsNullOrEmpty(parentConstraint.DisplayName))
                    {
                        vocabConstraint.displayName = parentConstraint.DisplayName;
                    }

                    if (parentConstraint.IsStatic == true && parentConstraint.ValueSetDate != null)
                    {
                        vocabConstraint.flexibility = parentConstraint.ValueSetDate.Value.ToString("yyyy-MM-ddThh:mm:ss");
                    }
                    else if (parentConstraint.IsStatic == false)
                    {
                        vocabConstraint.flexibility = "dynamic";
                    }

                    constraintRules.Add(vocabConstraint);
                }
            }

            foreach (var constraint in this.template.ChildConstraints.Where(y => y.ParentConstraintId == (parentConstraint != null ? parentConstraint.Id : (int?)null)))
            {
                if (!constraint.IsPrimitive)
                {
                    if (isAttribute)
                    {
                        continue;       // Can't export child elements/attributes of an attribute constraint
                    }
                    if (constraint.Context.StartsWith("@"))
                    {
                        constraintRules.Add(this.ExportAttribute(constraint));
                    }
                    else
                    {
                        constraintRules.Add(this.ExportElement(constraint));
                    }
                }
                else
                {
                    IFormattedConstraint formattedConstraint = FormattedConstraintFactory.NewFormattedConstraint(this.tdb, this.igSettings, constraint, null, null, false, false, false, false);

                    XmlNode[] anyField = new XmlNode[] { this.dom.CreateTextNode(formattedConstraint.GetPlainText(false, false, false)) };
                    constraintRules.Add(new FreeFormMarkupWithLanguage()
                    {
                        Any = anyField
                    });
                }
            }

            return(constraintRules.ToArray());
        }