示例#1
0
        public IActionResult Index(int id)
        {
            Property property = _properties.Get(id);

            PropertyIndexModel model = new PropertyIndexModel()
            {
                Id      = property.Id,
                Address = property.Address,
                Area    = property.Area,
                Rooms   = property.Rooms,
                Beds    = property.Beds,
                Rent    = property.Rent,
                Tenants = _tenants.GetAllFromProperty(id).Select(t => new TenantItemModel()
                {
                    Id             = t.Id,
                    FullName       = t.FullName,
                    Address        = t.RentedProperty.Address,
                    Email          = t.Email,
                    PhoneNumber    = t.PhoneNumber,
                    DateOfMovingIn = t.DateOfMovingIn.ToString("dd/MM/yyyy"),
                    Debt           = _tenants.GetMoneyOwed(t.Id)
                })
            };

            return(View(model));
        }