예제 #1
0
        //test
        private void SetViewData(long id, long type, bool init, bool isSuccess)
        {
            EntityReferenceHelper helper = new EntityReferenceHelper();

            // ViewData for Title
            ViewData["Title"]   = helper.GetEntityTitle(id, type);
            ViewData["Version"] = helper.CountVersions(id, type);
            // ViewData for enitity type list
            ViewData["TargetType"]    = helper.GetEntityTypes();
            ViewData["Target"]        = new SelectList(new List <SelectListItem>(), "Text", "Value");
            ViewData["TargetVersion"] = new SelectList(new List <SelectListItem>(), "Text", "Value");
            ViewData["ReferenceType"] = helper.GetReferencesTypes();
            //"This references is saved."
            if (isSuccess)
            {
                ViewData["Success"] = "This references is saved.";
            }

            ViewData["Init"] = init;
        }
예제 #2
0
        public ActionResult Create(long sourceId, long sourceTypeId)
        {
            if (hasUserRights(sourceId, sourceTypeId, RightType.Write))
            {
                EntityReferenceHelper helper = new EntityReferenceHelper();

                SetViewData(sourceId, sourceTypeId, true, false);

                return(PartialView("_create", new CreateSimpleReferenceModel(sourceId, sourceTypeId, helper.CountVersions(sourceId, sourceTypeId))));
            }

            return(null);
        }