Open Source Web Application Framework for ASP.NET Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

30 lines
546 B

using System;
using System.Collections.Generic;
using System.Linq;
using Volo.Abp.Domain.Entities;
namespace Volo.Abp.TestApp.Domain;
public class City : AggregateRoot<Guid>
{
public string Name { get; set; }
public ICollection<District> Districts { get; set; }
private City()
{
}
public City(Guid id, string name)
: base(id)
{
Name = name;
Districts = new List<District>();
}
public int GetPopulation()
{
return Districts.Select(d => d.Population).Sum();
}
}