public async Task <IActionResult> Edit(int id, [Bind("ID,LastName,FirstName,Email,PhoneNumber,EnrollmentDate,Street,City,Zip")] User user)
        {
            if (id != user.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,MaintenanceFees,Title,Price,SuitesNumber,Size,Cep,City,District,PhoneNumber,ParkingSpace,Leasing,Sale")] Apartment apartment)
        {
            if (id != apartment.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(apartment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ApartmentExists(apartment.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(apartment));
        }
        public async Task <IActionResult> Edit(int id, [Bind("UserApartmentID,UserID,ApartmentID,Owner,Resident")] UserApartment userApartment)
        {
            if (id != userApartment.UserApartmentID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(userApartment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserApartmentExists(userApartment.UserApartmentID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApartmentID"] = new SelectList(_context.Apartments, "ApartmentID", "Name", userApartment.ApartmentID);
            ViewData["UserID"]      = new SelectList(_context.Users, "ID", "LastName", userApartment.UserID);
            return(View(userApartment));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ContractId,ContractNo,RoomId,CustomerId,EngageMonth,BeginDate,ContractValue")] Contract contract)
        {
            if (id != contract.ContractId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contract);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContractExists(contract.ContractId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customer, "CustomerId", "CustomerName", contract.CustomerId);
            ViewData["RoomId"]     = new SelectList(_context.Room, "RoomId", "RoomNo", contract.RoomId);
            return(View(contract));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ApartmentId,AptAddress,SqFootage,MonthUtilityFee,MonthParkfee,LastCleanDate,IsVacant")] Apartment apartment)
        {
            if (id != apartment.ApartmentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(apartment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ApartmentExists(apartment.ApartmentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(apartment));
        }
Beispiel #6
0
        public async Task <IActionResult> Edit(int id, [Bind("TenantId,FirstName,LastName,Phone,Email")] Tenant tenant)
        {
            if (id != tenant.TenantId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tenant);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TenantExists(tenant.TenantId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(tenant));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CustomerId,CustomerName,BirthDay,IdentityCardNo,PhoneNo,Email,Gender,Status,DistrictId,ProvinceId")] Customer customer)
        {
            if (id != customer.CustomerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.CustomerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }

            ViewBag.Districts = new SelectList(_context.District.Where(x => x.ProvinceId == customer.ProvinceId), "DistrictName", "DistrictName", customer.DistrictId);

            ViewData["ProvinceId"] = new SelectList(_context.Province, "DistrictId", "DistrictName", customer.ProvinceId);
            return(View(customer));
        }
Beispiel #8
0
        public async Task <IActionResult> Edit(int id, [Bind("ApartmentID,Name,Garage,Shares")] Apartment apartment)
        {
            if (id != apartment.ApartmentID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(apartment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ApartmentExists(apartment.ApartmentID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(apartment));
        }
Beispiel #9
0
        public async Task <IActionResult> Edit(int id, [Bind("ContractId,StartDate,EndDate,MonthlyRent,ApartmentId,TenantId")] Contract contract)
        {
            if (id != contract.ContractId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contract);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContractExists(contract.ContractId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["ApartmentId"] = new SelectList(_context.Apartments, "ApartmentId", "ApartmentId", contract.ApartmentId);
            ViewData["TenantId"]    = new SelectList(_context.Tenants, "TenantId", "TenantId", contract.TenantId);
            return(View(contract));
        }
        public async Task <IActionResult> Edit(int id, [Bind("RoomId,RoomNo,RoomTypeId,Price,Area,Status")] Room room)
        {
            if (id != room.RoomId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(room);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RoomExists(room.RoomId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["RoomTypeId"] = new SelectList(_context.RoomType, "RoomTypeId", "RoomTypeName", room.RoomTypeId);
            return(View(room));
        }