Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("EmployeeId,FirstName,LastName,Email,Password,DateCreated")] Employees employees)
        {
            if (id != employees.EmployeeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employees);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeesExists(employees.EmployeeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employees));
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("WorkOrderId,Description,ResidentId,StatusId,EmployeeId,Notes,DateCompleted,DateUpdated,DateCreated")] WorkOrders workOrders)
        {
            if (id != workOrders.WorkOrderId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(workOrders);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WorkOrdersExists(workOrders.WorkOrderId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"] = new SelectList(_context.Employees, "EmployeeId", "Email", workOrders.EmployeeId);
            ViewData["ResidentId"] = new SelectList(_context.Residents, "ResidentId", "Address", workOrders.ResidentId);
            ViewData["StatusId"]   = new SelectList(_context.Statuses, "StatusId", "Title", workOrders.StatusId);
            return(View(workOrders));
        }
        public async Task <IActionResult> Edit(int id, [Bind("StatusId,Title,DateCreated")] Statuses statuses)
        {
            if (id != statuses.StatusId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(statuses);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StatusesExists(statuses.StatusId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(statuses));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ResidentId,FirstName,LastName,Address,UnitNumber,City,State,Zip,Phone,Email,DateCreated")] Residents residents)
        {
            if (id != residents.ResidentId)
            {
                return(NotFound());
            }

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