// GET: Employee/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(HttpNotFound()); } Employee employee = _employeeManager.GetById((int)id); EditEmployeeViewModel employeeVM = new EditEmployeeViewModel(); employeeVM.Id = employee.Id; employeeVM.Name = employee.Name; employeeVM.ContactNo = employee.ContactNo; employeeVM.Email = employee.Email; employeeVM.Address1 = employee.Address1; employeeVM.Address2 = employee.Address2; employeeVM.Status = "employee"; //employeeVM.IsDriver = employee.IsDriver; employeeVM.DepartmentId = (int)employee.DepartmentId; employeeVM.DesignationId = (int)employee.DesignationId; employeeVM.DivisionId = (int)employee.DivisionId; employeeVM.DistrictId = (int)employee.DistrictId; employeeVM.ThanaId = (int)employee.ThanaId; ViewBag.DepartmentId = new SelectList(_departmentManager.GetAll(), "Id", "Name", employee.DepartmentId); ViewBag.DesignationId = new SelectList(_designationManager.GetAll(), "Id", "Name", employee.DesignationId); ViewBag.DivisionId = new SelectList(_divisionManager.GetAll(), "Id", "Name", employee.DivisionId); ViewBag.DistrictId = new SelectList(_districtManager.GetAll(), "Id", "Name", employee.DistrictId); ViewBag.ThanaId = new SelectList(_thanaManager.GetAll(), "Id", "Name", employee.ThanaId); return(View(employeeVM)); }
public JsonResult Get_databyid(int id) { var res = _iEmployeeManager.GetById(id); return(Json(res, JsonRequestBehavior.AllowGet)); }
public ActionResult Update_data(int id) { Employee employee = _iEmployeeManager.GetById(id); return(View(employee)); }
// GET: Driver/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(HttpNotFound()); } Employee driver = _employeeManager.GetById((int)id); EditDriverViewModel driverVm = new EditDriverViewModel(); driverVm.Id = driver.Id; driverVm.Name = driver.Name; driverVm.ContactNo = driver.ContactNo; driverVm.Email = driver.Email; driverVm.Address1 = driver.Address1; driverVm.Address2 = driver.Address2; driverVm.LicenceNo = driver.LicenceNo; driverVm.IsDriver = driver.IsDriver; driverVm.DepartmentId = (int)driver.DepartmentId; driverVm.DesignationId = (int)driver.DesignationId; driverVm.DivisionId = (int)driver.DivisionId; driverVm.DistrictId = (int)driver.DistrictId; driverVm.ThanaId = (int)driver.ThanaId; ViewBag.DepartmentId = new SelectList(_departmentManager.GetAll(), "Id", "Name", driver.DepartmentId); ViewBag.DesignationId = new SelectList(_designationManager.GetAll(), "Id", "Name", driver.DesignationId); ViewBag.DivisionId = new SelectList(_divisionManager.GetAll(), "Id", "Name", driver.DivisionId); ViewBag.DistrictId = new SelectList(_districtManager.GetAll(), "Id", "Name", driver.DistrictId); ViewBag.ThanaId = new SelectList(_thanaManager.GetAll(), "Id", "Name", driver.ThanaId); return(View(driverVm)); }
// GET: Employee/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var department = _departmentManager.GetAll(); var designation = _designationManager.GetAll(); var division = _divisionManager.GetAll(); var district = _districtManager.GetAll(); var thana = _thanaManager.GetAll(); Employee employee = _employeeManager.GetById((int)id); EmployeeViewModel employeeVM = new EmployeeViewModel() { Id = employee.Id, Name = employee.Name, ContactNo = employee.ContactNo, Email = employee.Email, Address1 = employee.Address1, Address2 = employee.Address2, LicenceNo = employee.LicenceNo, Department = department.Where(x => x.Id == employee.DepartmentId).FirstOrDefault(), Designation = designation.Where(x => x.Id == employee.DesignationId).FirstOrDefault(), Division = division.Where(x => x.Id == employee.DivisionId).FirstOrDefault(), District = district.Where(x => x.Id == employee.DistrictId).FirstOrDefault(), Thana = thana.Where(x => x.Id == employee.ThanaId).FirstOrDefault() }; return(View(employeeVM)); }
public ActionResult DeleteEmployee(int id) { var employee = _employeeManager.GetById(id); employee.IsActive = !employee.IsActive; _employeeManager.Update(employee); return(RedirectToAction("Index")); }
public IActionResult Edit(int?id) { if (id != null && id > 0) { Employee existingemployee = _employeeManagerl.GetById(id); if (existingemployee != null) { return(View(existingemployee)); } } return(View()); }
public ActionResult UpdateBasicInfo(int id) { try { Employee employee = _iEmployeeManager.GetById(id); return(View(employee)); } catch (Exception exception) { Log.WriteErrorLog(exception); return(PartialView("_ErrorPartial", exception)); } }
public IActionResult GeteEmployee(int id) { if (id == null) { return(NotFound("Employee Not Found")); } var employee = _employeeManager.GetById(id); if (employee == null) { return(NotFound("Employee Not Found")); } return(Ok(employee)); }
public ActionResult Edit(int id) { Employee employee = _iEmployeeManager.GetById(id); var departments = _iDepartmentManager.GetAll(); var empTypes = _iEmployeeTypeManager.GetAll(); var branches = _iBranchManager.GetAllBranches(); var designations = _iDesignationManager.GetAll(); ViewBag.EmployeeTypeId = new SelectList(empTypes, "EmployeeTypeId", "EmployeeTypeName"); ViewBag.BranchId = new SelectList(branches, "BranchId", "BranchName"); ViewBag.DepartmentId = new SelectList(departments, "DepartmentId", "DepartmentName"); ViewBag.DesignationId = new SelectList(designations, "DesignationId", "DesignationName"); return(View(employee)); }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var employee = employeeManager.GetById((int)id); if (employee == null) { return(HttpNotFound()); } EmployeeViewModel employeeViewModel = new EmployeeViewModel(); return(View(employee)); }
private void DriverAssigned(int?employeeId) { if (employeeId == null) { return; } var driver = _employeeManager.GetById((int)employeeId); //var departmentManager = _departmentManager.GetAll(); //var designationManager = _designationManager.GetAll(); //var divisionManager = _divisionManager.GetAll(); //var districtManager = _districtManager.GetAll(); //var thanaManager = _thanaManager.GetAll(); Employee employee = new Employee(); employee.Id = driver.Id; employee.DepartmentId = driver.DepartmentId; employee.DesignationId = driver.DesignationId; employee.DivisionId = driver.DivisionId; employee.DistrictId = driver.DistrictId; employee.ThanaId = driver.ThanaId; employee.Status = "Assign"; _employeeManager.Update(employee); return; }
// GET: /Employee/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Employee employee = _employeeManager.GetById((int)id); if (employee == null) { return(HttpNotFound()); } var DepartmentsList = _departmentManager.GetAll(); var DesignationsList = _designationManager.GetAll(); ViewBag.DepartmentID = new SelectList(DepartmentsList, "DepartmentID", "DepartmentName"); ViewBag.DesignationID = new SelectList(DesignationsList, "DesignationID", "DesignationName"); return(View(employee)); }
public IActionResult GetById(int id) { try { return(Ok(_employeeManager.GetById(id))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
// GET: Driver/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(HttpNotFound()); } Employee driver = _employeeManager.GetById((int)id); EditDriverViewModel driverVm = new EditDriverViewModel { Id = driver.Id, Name = driver.Name, ContactNo = driver.ContactNo, Email = driver.Email, Address1 = driver.Address1, //Address2 = driver.Address2, LicenceNo = driver.LicenceNo, //IsDriver = driver.IsDriver, DepartmentId = (int)driver.DepartmentId, DesignationId = (int)driver.DesignationId, DivisionId = (int)driver.DivisionId, DistrictId = (int)driver.DistrictId, ThanaId = (int)driver.ThanaId, ImagePath = driver.ImagePath }; ViewBag.DepartmentId = new SelectList(_departmentManager.GetAll(), "Id", "Name", driver.DepartmentId); ViewBag.DesignationId = new SelectList(_designationManager.GetAll(), "Id", "Name", driver.DesignationId); ViewBag.DivisionId = new SelectList(_divisionManager.GetAll(), "Id", "Name", driver.DivisionId); ViewBag.DistrictId = new SelectList(_districtManager.GetAll(), "Id", "Name", driver.DistrictId); ViewBag.ThanaId = new SelectList(_thanaManager.GetAll(), "Id", "Name", driver.ThanaId); return(View(driverVm)); }
public ActionResult Details_V2(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Requsition requisition = _requisitionManager.GetById((int)id); var userEmployeeId = GetEmployeeId(); ViewBag.UserEmployeeId = userEmployeeId; var driverId = 0; var vehicleId = 0; switch (requisition.Status) { case "Assign": driverId = driverStatusManager.Get(c => c.RequsitionId == id && c.Status == "Assign").Select(c => c.EmployeeId).FirstOrDefault(); vehicleId = vehicleStatusManager.Get(c => c.RequsitionId == id && c.Status == "Assign").Select(c => c.VehicleId).FirstOrDefault(); break; case "Complete": driverId = driverStatusManager.Get(c => c.RequsitionId == id && c.Status == "Complete").Select(c => c.EmployeeId).FirstOrDefault(); vehicleId = vehicleStatusManager.Get(c => c.RequsitionId == id && c.Status == "Complete").Select(c => c.VehicleId).FirstOrDefault(); break; } //if (requisition.Status == "Assign") //{ // driverId = driverStatusManager.Get(c => c.RequsitionId == id && c.Status== "Assign").Select(c => c.EmployeeId).FirstOrDefault(); // vehicleId = vehicleStatusManager.Get(c => c.RequsitionId == id && c.Status == "Assign").Select(c => c.VehicleId).FirstOrDefault(); //} //if (requisition.Status == "Complete") //{ // driverId = driverStatusManager.Get(c => c.RequsitionId == id && c.Status == "Complete").Select(c => c.EmployeeId).FirstOrDefault(); // vehicleId = vehicleStatusManager.Get(c => c.RequsitionId == id && c.Status == "Complete").Select(c => c.VehicleId).FirstOrDefault(); //} if (!User.IsInRole("Controller")) { if (requisition.EmployeeId != userEmployeeId && requisition.RequestedBy != userEmployeeId && driverId != userEmployeeId) { TempData["msg"] = "Sorry, you have no permission to access this type of data!"; return(RedirectToAction("Dashboard", "Home")); } } AssignedListViewModel assignVm = new AssignedListViewModel { Requisition = requisition, Employee = _employeeManager.GetById((int)requisition.EmployeeId), Driver = _employeeManager.GetById(driverId), Vehicle = vehicleManager.GetById(vehicleId) }; GetCommentViewModelForInsertComment(requisition, userEmployeeId, assignVm); //Collect the list of comment to display the list under comment GetCommentList(requisition, assignVm); return(View(assignVm)); }
// GET: Employee/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(HttpNotFound()); } Employee employee = _employeeManager.GetById((int)id); var employeeVM = new EditEmployeeViewModel { Id = employee.Id, //UserId = employee.UserId, Name = employee.Name, ContactNo = employee.ContactNo, Email = employee.Email, Address1 = employee.Address1, //Address2 = employee.Address2, //Status = "employee", DepartmentId = (int)employee.DepartmentId, DesignationId = (int)employee.DesignationId, DivisionId = (int)employee.DivisionId, DistrictId = (int)employee.DistrictId, ThanaId = (int)employee.ThanaId, Image = employee.Image, ImagePath = employee.ImagePath //UserRole = employee.UserRole }; //employeeVM.IsDriver = employee.IsDriver; ViewBag.DepartmentId = new SelectList(_departmentManager.GetAll(), "Id", "Name", employee.DepartmentId); ViewBag.DesignationId = new SelectList(_designationManager.GetAll(), "Id", "Name", employee.DesignationId); ViewBag.DivisionId = new SelectList(_divisionManager.GetAll(), "Id", "Name", employee.DivisionId); ViewBag.DistrictId = new SelectList(_districtManager.GetAll(), "Id", "Name", employee.DistrictId); ViewBag.ThanaId = new SelectList(_thanaManager.GetAll(), "Id", "Name", employee.ThanaId); return(View(employeeVM)); }
// GET: Employee/Details/5 public ActionResult Details(int id) { var employee = _employeeManager.GetById(id); if (employee == null) { return(NotFound()); } var model = (employee); return(View(model)); }
public IActionResult GetById(int id) { Request.Headers.TryGetValue("Authorization", out var token); string email = _accountManager.GetEmailByToken(token); try { EmployeeViewModel result = _employeeManager.GetById(id, email); if (result == null) { return(Conflict("Empty!!!")); } return(Ok(result)); } catch (Exception) { return(Conflict("You have no permission to get this Employee!!!")); } }