79617678

Date: 2025-05-12 10:53:43
Score: 1.5
Natty:
Report link

enter image description here creation

enter image description here models

enter image description here navigation property

enter image description here dbset making

enter image description here scaffolded itmes creation

enter image description here dto creation

enter image description here put endpoint changes

here is a code for that:

builder.Services.AddSwaggerGen();

builder.Services.AddDbContext<IngatlanContext>(options =>
    options.UseSqlite(builder.Configuration.GetConnectionString("DefaultConnection")));

var app = builder.Build();

--------------------------------
public class IngatlanContext : DbContext
{
    public IngatlanContext(DbContextOptions<IngatlanContext> options) : base(options)
    {

    }
    public DbSet<Ingatlan> Ingatlanok { get; set; } = null!;
    public DbSet<Kategoria> Kategoriak { get; set; } = null!;
}

--------------------------------
public class IngatlanGetDto
{
    public int Id { get; set; }
    public string? Leiras { get; set; }
    public DateTime HirdetesKezdete { get; set; }
    public DateTime HirdetesVege { get; set; }
    public int Ar { get; set; }
    public bool Hitelkepes { get; set; }
    public string? KategoriaNeve { get; set; }
}

--------------------------------
Kategoria (1) - Ingatlan (N)
N: 
[ForeignKey("KategoriaId")]
public Kategoria? Kategoria { get; set; }
1:
[JsonIgnore]
public List<Ingatlan>? Ingatlanok { get; set; }
Reasons:
  • Blacklisted phrase (1): enter image description here
  • Probably link only (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: orbanviktor