public async Task <IActionResult> Edit(int id, [Bind("ShiftId,ShiftTypeId,ShiftDate")] Shift shift)
        {
            if (id != shift.ShiftId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(shift);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShiftExists(shift.ShiftId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ShiftTypeId"] = new SelectList(_context.ShiftTypes, "ShiftTypeId", "Name", shift.ShiftTypeId);
            return(View(shift));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("ShiftTypeId,Name,StartOffsetHrs,StartOffsetMins,RoasterSequence,ShiftSequence,ColorString")] ShiftType shiftType)
        {
            if (id != shiftType.ShiftTypeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(shiftType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShiftTypeExists(shiftType.ShiftTypeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(shiftType));
        }
Esempio n. 3
0
        public async Task <IActionResult> Edit(int id, [Bind("ShiftRoleId,RoleName")] ShiftRole shiftRole)
        {
            if (id != shiftRole.ShiftRoleId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(shiftRole);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShiftRoleExists(shiftRole.ShiftRoleId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(shiftRole));
        }
        public async Task <IActionResult> Edit(int id, [Bind("GenderId,Name")] Gender gender)
        {
            if (id != gender.GenderId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(gender);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GenderExists(gender.GenderId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(gender));
        }
Esempio n. 5
0
        public async Task <IActionResult> Edit(int id, [Bind("EmployeeId,OfficeId,GenderId,Name,Phone,Email,Dob,IsActive,ShiftRoleId,ShiftGroupId")] Employee employee)
        {
            if (id != employee.EmployeeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.EmployeeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GenderId"]     = new SelectList(_context.Genders, "GenderId", "Name", employee.GenderId);
            ViewData["ShiftGroupId"] = new SelectList(_context.ShiftGroups, "ShiftGroupId", "Name", employee.ShiftGroupId);
            ViewData["ShiftRoleId"]  = new SelectList(_context.ShiftRoles, "ShiftRoleId", "RoleName", employee.ShiftRoleId);
            return(View(employee));
        }
        public async Task <IActionResult> Edit(int id, [Bind("EmployeeShiftSkillId,EmployeeId,ShiftSkillId")] EmployeeShiftSkill employeeShiftSkill)
        {
            if (id != employeeShiftSkill.EmployeeShiftSkillId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employeeShiftSkill);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeShiftSkillExists(employeeShiftSkill.EmployeeShiftSkillId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"]   = new SelectList(_context.Employees, "EmployeeId", "Name", employeeShiftSkill.EmployeeId);
            ViewData["ShiftSkillId"] = new SelectList(_context.ShiftSkills, "ShiftSkillId", "Name", employeeShiftSkill.ShiftSkillId);
            return(View(employeeShiftSkill));
        }