Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("StaffMemberID,FirstName,LastName,Email,Phone")] StaffMember staffMember)
        {
            if (id != staffMember.StaffMemberID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(staffMember);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StaffMemberExists(staffMember.StaffMemberID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(staffMember));
        }
        public async Task <IActionResult> Edit(int id, [Bind("InventoryID,ProductNo,ProductName,ProductAmount")] Inventory inventory)
        {
            if (id != inventory.InventoryID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(inventory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InventoryExists(inventory.InventoryID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(inventory));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(int id, [Bind("ClientID,Name,Phone,Address,City,Province,PostalCode,Email,StaffMemberID,SupervisorID")] Client client)
        {
            if (id != client.ClientID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(client);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientExists(client.ClientID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StaffMemberID"] = new SelectList(_context.StaffMembers, "StaffMemberID", "Email", client.StaffMemberID);
            ViewData["SupervisorID"]  = new SelectList(_context.Supervisors, "SupervisorID", "Email", client.SupervisorID);
            return(View(client));
        }
Beispiel #4
0
        public async Task <IActionResult> Edit(int id, [Bind("SupervisorID,FirstName,LastName,Email,Phone,InventoryID")] Supervisor supervisor)
        {
            if (id != supervisor.SupervisorID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(supervisor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SupervisorExists(supervisor.SupervisorID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["InventoryID"] = new SelectList(_context.Inventories, "InventoryID", "ProductName", supervisor.InventoryID);
            return(View(supervisor));
        }