예제 #1
0
        public IActionResult Entity(String type, String Id)
        {
            IEnumerable <ITable> tables = ModeLayer.GetTable();

            if (type == null)
            {
                return(View("List", tables));
            }
            Type typeModel = null;

            Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
            foreach (Assembly ass in assemblies)
            {
                typeModel = ass.GetType(type);
                if (typeModel != null)
                {
                    break;
                }
            }
            if (typeModel != null)
            {
                ITable    table      = tables.Where(r => typeModel.IsSubclassOf(r.TypeEntity) || typeModel == r.TypeEntity).FirstOrDefault();
                IMyEntity myEntities = ModeLayer.GetEntity(table.TypeEntity).Where(r => r.Id.ToString() == Id).FirstOrDefault();
                if (myEntities != null)
                {
                    return(View(myEntities));
                }
            }
            return(View("List", tables));
        }
예제 #2
0
        public IActionResult Table(String type)
        {
            IEnumerable <ITable> tables = ModeLayer.GetTable();

            if (type == null)
            {
                return(View("List", tables));
            }
            IEnumerable <ITable> table = tables.Where(r => r.TypeEntity.Name == type);


            if (table.Count() == 1)
            {
                IEnumerable <IMyEntity> myEntities = ModeLayer.GetEntity(table.FirstOrDefault().TypeEntity);
                IMyEntity myEntity = myEntities.FirstOrDefault();



                return(View(myEntities));
            }
            else
            {
                return(View("List", tables));
            }
        }