예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,PTO,RoleId,ContactId,ClockedIn")] Employee employee)
        {
            if (id != employee.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ContactId"] = new SelectList(_context.Contacts, "Id", "Id", employee.ContactId);
            ViewData["RoleId"]    = new SelectList(_context.Roles, "Id", "Id", employee.RoleId);
            return(View(employee));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,EmployeeId,Hours,Reason")] PTORequest pTORequest)
        {
            if (id != pTORequest.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pTORequest);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PTORequestExists(pTORequest.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"] = new SelectList(_context.Employees, "Id", "Id", pTORequest.EmployeeId);
            return(View(pTORequest));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Role role)
        {
            if (id != role.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(role);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RoleExists(role.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(role));
        }
예제 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Address,City,State,Phone")] Contact contact)
        {
            if (id != contact.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contact);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContactExists(contact.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(contact));
        }
예제 #5
0
        public async Task <IActionResult> EditEmployee(int id, [Bind("Id,FirstName,LastName,PTO,RoleId,ContactId,ClockedIn")] Employee employee) //rename this method
        {
            if (employee.Id != id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                }
            }

            return(RedirectToAction("ManageEmployee"));
        }
 public void Update(Report report)
 {
     _context.Update(report);
     _context.SaveChanges();
 }
예제 #7
0
 public void Update(Deviation deviation)
 {
     _context.Update(deviation);
     _context.SaveChanges();
 }