public async Task <IActionResult> PutShiftParticipation([FromRoute] int id, [FromBody] ShiftParticipation shiftParticipation) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != shiftParticipation.ShiftParticipationId) { return(BadRequest()); } _context.Entry(shiftParticipation).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShiftParticipationExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("ShiftTypeId,Name,StartOffsetHrs,StartOffsetMins,RoasterSequence,ShiftSequence,ColorString")] ShiftType shiftType) { if (ModelState.IsValid) { _context.Add(shiftType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(shiftType)); }
public async Task <IActionResult> Create([Bind("ShiftRoleId,RoleName")] ShiftRole shiftRole) { if (ModelState.IsValid) { _context.Add(shiftRole); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(shiftRole)); }
public async Task <IActionResult> Create([Bind("GenderId,Name")] Gender gender) { if (ModelState.IsValid) { _context.Add(gender); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(gender)); }
public async Task <IActionResult> Create([Bind("ShiftParticipationTypeId,Name,IsAbsence,IsBold,ColorString")] ShiftParticipationType shiftParticipationType) { if (ModelState.IsValid) { _context.Add(shiftParticipationType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(shiftParticipationType)); }
public async Task <IActionResult> Create([Bind("ShiftId,ShiftTypeId,ShiftDate")] Shift shift) { if (ModelState.IsValid) { _context.Add(shift); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ShiftTypeId"] = new SelectList(_context.ShiftTypes, "ShiftTypeId", "Name", shift.ShiftTypeId); return(View(shift)); }
public async Task <IActionResult> Create([Bind("EmployeeShiftSkillId,EmployeeId,ShiftSkillId")] EmployeeShiftSkill employeeShiftSkill) { if (ModelState.IsValid) { _context.Add(employeeShiftSkill); await _context.SaveChangesAsync(); 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)); }
public async Task <IActionResult> Create([Bind("ShiftParticipationId,EmployeeId,ShiftId")] ShiftParticipation shiftParticipation) { if (ModelState.IsValid) { _context.Add(shiftParticipation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EmployeeId"] = new SelectList(_context.Employees, "EmployeeId", "Name", shiftParticipation.EmployeeId); ViewData["ShiftId"] = new SelectList(_context.Shifts, "ShiftId", "ShiftId", shiftParticipation.ShiftId); return(View(shiftParticipation)); }
public async Task <IActionResult> Create([Bind("EmployeeId,OfficeId,GenderId,Name,Phone,Email,Dob,IsActive,ShiftRoleId,ShiftGroupId")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); 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> PutShiftComments([FromRoute] int id, [FromBody] CommentsEditViewModel shiftComments) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } // get the required shift by id Shift shift = await _context.Shifts.FindAsync(id); if (shift == null) { return(BadRequest()); } //edit the comments shift.Comments = shiftComments.Comments; // save changes _context.Entry(shift).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShiftExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }