fixes and tweaks
This commit is contained in:
@@ -5,6 +5,7 @@ namespace Lutra.Domain.Entities;
|
||||
public class Verspakket : BaseEntity
|
||||
{
|
||||
private readonly List<Beoordeling> _beoordelingen = [];
|
||||
private readonly List<VerspakketFoto> _fotos = [];
|
||||
|
||||
[MaxLength(50)]
|
||||
public required string Naam { get; set; }
|
||||
@@ -13,7 +14,7 @@ public class Verspakket : BaseEntity
|
||||
public int? PrijsInCenten { get; set; }
|
||||
|
||||
[Range(1, 10)]
|
||||
public int AantalPersonen { get; set; }
|
||||
public required int AantalPersonen { get; set; }
|
||||
|
||||
public required Guid SupermarktId { get; set; }
|
||||
|
||||
@@ -21,11 +22,18 @@ public class Verspakket : BaseEntity
|
||||
|
||||
public IReadOnlyCollection<Beoordeling> Beoordelingen => _beoordelingen.AsReadOnly();
|
||||
|
||||
public IReadOnlyCollection<VerspakketFoto> Fotos => _fotos.AsReadOnly();
|
||||
|
||||
public void AddBeoordeling(Beoordeling beoordeling)
|
||||
{
|
||||
_beoordelingen.Add(beoordeling);
|
||||
}
|
||||
|
||||
public void AddFoto(VerspakketFoto foto)
|
||||
{
|
||||
_fotos.Add(foto);
|
||||
}
|
||||
|
||||
public bool RemoveBeoordeling(Guid id)
|
||||
{
|
||||
var beoordeling = _beoordelingen.Find(b => b.Id == id);
|
||||
@@ -35,4 +43,14 @@ public class Verspakket : BaseEntity
|
||||
_beoordelingen.Remove(beoordeling);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool RemoveFoto(Guid id)
|
||||
{
|
||||
var foto = _fotos.Find(f => f.Id == id);
|
||||
if (foto is null)
|
||||
return false;
|
||||
|
||||
_fotos.Remove(foto);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user