Ejemplo n.º 1
0
        public async Task <IActionResult> OnGetAsync(string id, string table)
        {
            var entity = await EntitiesService.FindByIdAndTableNameAsync(id, table);

            if (entity == null)
            {
                return(NotFound());
            }

            var props = EntitiesService.GetEntityPropertiesByTable(table).Where(p => !p.IsForeignKey());

            if (props == null)
            {
                return(NotFound());
            }

            ForeignKeys = EntitiesService.GetForeignKeyPropertiesToDto(entity).ToList();

            ViewData["EntityId"]  = id;
            ViewData["TableName"] = table;

            TableName  = table;
            PageTitle  = $"{BtnUpdateValue} - {entity.GetType().GetProperty(PropertyNameConstants.Name)?.GetValue(entity)}";
            Entity     = entity;
            EntityId   = id;
            Properties = props.ToList();

            return(Page());
        }
Ejemplo n.º 2
0
        public IActionResult OnGet(string table)
        {
            var properties = EntitiesService.GetEntityPropertiesByTable(table);

            if (properties == null)
            {
                return(NotFound());
            }
            ViewData["TableName"] = table;

            if (EntitiesService.InheritsFromKeryKeionBaseClass(EntitiesService.FindEntityTypeByTableName(table)))
            {
                Properties = properties.Where(p => !p.IsPrimaryKey() && !p.Name.Equals("datetimecreated", StringComparison.OrdinalIgnoreCase)).ToList();
            }
            else
            {
                Properties = properties.ToList();
            }

            PageTitle = $"{BtnCreateValue} {EntitiesService.FindEntityTypeByTableName(table)?.ClrType?.Name}";
            TableName = table;
            return(Page());
        }