コード例 #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));
        }
コード例 #2
0
        public IActionResult Index(int id)
        {
            Tenant tenant = _tenants.Get(id);

            if (tenant != null)
            {
                TenantIndexModel model = new TenantIndexModel()
                {
                    TenantId       = tenant.Id,
                    TenantName     = tenant.FullName,
                    TenantAddress  = tenant.RentedProperty.Address,
                    DateOfMovingIn = tenant.DateOfMovingIn.Date.ToString("dd/MM/yyyy"),
                    Email          = tenant.Email,
                    PhoneNumber    = tenant.PhoneNumber,
                    MoneyOwed      = _tenants.GetMoneyOwed(tenant.Id)
                };

                return(View(model));
            }

            return(RedirectToAction("All"));
        }