public async Task <IActionResult> Edit(int id, [Bind("Id,ComId,Name")] Designation designation) { if (id != designation.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(designation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DesignationExists(designation.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ComId"] = new SelectList(_context.UserResistration, "ComId", "ComId", designation.ComId); return(View(designation)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ComId,Name")] Designation designation) { if (id != designation.Id) { return(NotFound()); } if (ModelState.IsValid) { try { designation.ComId = session.GetString("ComSessionId"); _context.Update(designation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DesignationExists(designation.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(designation)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ComId,Leavetype,Value")] LeaveSetup leaveSetup) { if (id != leaveSetup.Id) { return(NotFound()); } if (ModelState.IsValid) { try { leaveSetup.ComId = session.GetString("ComSessionId"); _context.Update(leaveSetup); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LeaveSetupExists(leaveSetup.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(leaveSetup)); }
public async Task <IActionResult> Edit(string id, [Bind("Id,ComId,Name,Code,Phone,Email,Address,JoinDate,BirthDate,Sex,Religion,SectionId,DesignationId,Gs")] EmployeeInfo employeeInfo) { if (id != employeeInfo.Id) { return(NotFound()); } if (ModelState.IsValid) { try { employeeInfo.ComId = session.GetString("ComSessionId"); _context.Update(employeeInfo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeInfoExists(employeeInfo.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DesignationId"] = new SelectList(_context.Designation.Where(d => d.ComId == session.GetString("ComSessionId")), "Id", "Name"); ViewData["SectionId"] = new SelectList(_context.Section.Where(s => s.ComId == session.GetString("ComSessionId")), "Id", "Name"); return(View(employeeInfo)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ComId,EmpId,FromDate,ToDate,LvDays,LeaveId,Remarks")] LeaveInput leaveInput) { if (id != leaveInput.Id) { return(NotFound()); } if (ModelState.IsValid) { try { leaveInput.ComId = session.GetString("ComSessionId"); _context.Update(leaveInput); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LeaveInputExists(leaveInput.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EmpId"] = new SelectList(_context.EmployeeInfo, "Id", "Name", leaveInput.EmpId); ViewData["LeaveId"] = new SelectList(_context.LeaveSetup, "Id", "Leavetype", leaveInput.LeaveId); return(View(leaveInput)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ComId,Fromdt,Todt,Hstatus")] Holiday holiday) { if (id != holiday.Id) { return(NotFound()); } if (ModelState.IsValid) { try { holiday.ComId = session.GetString("ComSessionId"); _context.Update(holiday); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HolidayExists(holiday.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(holiday)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ComId,EmpId,Cl,Sl,El,Ml,Acl,Bcl,Asl,Bsl,Ael,Bel,Aml,Bml")] LeaveBalance leaveBalance) { if (id != leaveBalance.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(leaveBalance); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LeaveBalanceExists(leaveBalance.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ComId"] = new SelectList(_context.UserResistration, "ComId", "ComId", leaveBalance.ComId); ViewData["EmpId"] = new SelectList(_context.EmployeeInfo, "Id", "Id", leaveBalance.EmpId); return(View(leaveBalance)); }
public async Task <IActionResult> Edit(string id, [Bind("ComId,ComName,ComAddress,ComType")] UserResistration companyInfo) { _context.Update(companyInfo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ComId,RoleId,UserId")] UserRole userRole) { if (session.GetString("Role") != "Admin") { return(LocalRedirect("/")); } if (id != userRole.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(userRole); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserRoleExists(userRole.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["RoleId"] = new SelectList(_context.Role, "Id", "RoleName", userRole.RoleId); // ViewData["RoleId"] = new SelectList(_context.Role, "Id", "RoleName"); ViewData["UserId"] = new SelectList(_db.AspNetUsers, "Id", "UserName"); return(View(userRole)); }
public string LeaveAproval(LeaveAvailable leave) { string comId = session.GetString("ComId"); LeaveAvailable leaveAvailable = new LeaveAvailable(); LeaveBalance leaveBalance = db.LeaveBalance.FirstOrDefault(l => l.ComId == comId && l.EmpId == leave.EmpId); if (leaveBalance != null) { LeaveAvailable lAvail = new LeaveAvailable(); int count = 0; switch (leave.LeaveType) { case "CL": count = Convert.ToInt32(leaveBalance.Bcl); if (count >= leave.LeaveApprove) { leaveBalance.Acl += leave.LeaveApprove; leaveBalance.Bcl -= leave.LeaveApprove; db.Update(leaveBalance); lAvail = SetData(leave); db.LeaveAvailable.Add(lAvail); db.SaveChanges(); message = "Leave entry succeed"; } else { message = "The employee has leave available" + count + "Day"; } break; case "SL": count = Convert.ToInt32(leaveBalance.Bsl); if (count >= leave.LeaveApprove) { leaveBalance.Asl += leave.LeaveApprove; leaveBalance.Bsl -= leave.LeaveApprove; lAvail = SetData(leave); db.LeaveAvailable.Add(lAvail); db.SaveChanges(); message = "Leave entry succeed"; } else { message = "The employee has leave available" + count + "Day"; } break; case "EL": count = Convert.ToInt32(leaveBalance.Bel); if (count >= leave.LeaveApprove) { leaveBalance.Ael += leave.LeaveApprove; leaveBalance.Bel -= leave.LeaveApprove; lAvail = SetData(leave); db.LeaveAvailable.Add(lAvail); db.SaveChanges(); message = "Leave entry succeed"; } else { message = "The employee has leave available" + count + "Day"; } break; case "ML": count = Convert.ToInt32(leaveBalance.Bml); if (count >= leave.LeaveApprove) { leaveBalance.Aml += leave.LeaveApprove; leaveBalance.Bml -= leave.LeaveApprove; lAvail = SetData(leave); db.LeaveAvailable.Add(lAvail); db.SaveChanges(); message = "Leave entry succeed"; } else { message = "The employee has leave available" + count + "Day"; } break; default: message = "Leave type is not valid"; break; } //db.LeaveAvailable.Add(lAvail); //db.SaveChanges(); } else { message = "No leave balnce of this employee"; } return(message); }