public async Task <IActionResult> Edit(int id, [Bind("LeaserId,FirstName,LastName,Email,Address,City,State,ZipCode,Comments,PhoneNumber")] PropertyLeaser propertyLeaser)
        {
            if (id != propertyLeaser.LeaserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(propertyLeaser);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PropertyLeaserExists(propertyLeaser.LeaserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(propertyLeaser));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("PropertyId,OwnerId,LeaserId,Picture,Address,SquareFeet,Bedrooms,Baths,Year,Features,MonthlyRate,Utilities,ContractTime,PaymentId")] Property @property)
        {
            if (id != @property.PropertyId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(@property);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PropertyExists(@property.PropertyId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LeaserId"]  = new SelectList(_context.PropertyLeaser, "LeaserId", "LeaserId", @property.LeaserId);
            ViewData["OwnerId"]   = new SelectList(_context.PropertyOwner, "OwnerId", "OwnerId", @property.OwnerId);
            ViewData["PaymentId"] = new SelectList(_context.PaymentHistory, "PaymentId", "PaymentId", @property.PaymentId);
            return(View(@property));
        }
        public async Task <IActionResult> Edit(int id, [Bind("MaintenanceId,PropertyId,Description,Documents,Priority")] MaintenanceRequest maintenanceRequest)
        {
            if (id != maintenanceRequest.MaintenanceId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(maintenanceRequest);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MaintenanceRequestExists(maintenanceRequest.MaintenanceId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PropertyId"] = new SelectList(_context.Property, "PropertyId", "PropertyId", maintenanceRequest.PropertyId);
            return(View(maintenanceRequest));
        }
        public async Task <IActionResult> Edit(int id, [Bind("PaymentId,TotalPayments,TotalPaid,TotalLate,TotalMonths")] PaymentHistory paymentHistory)
        {
            if (id != paymentHistory.PaymentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(paymentHistory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PaymentHistoryExists(paymentHistory.PaymentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(paymentHistory));
        }