public EmployeeTaskDTO UpdateEmployeeTaskDetails(EmployeeTaskViewModel employeeTaskViewModel) { var employeeTask = UpdateEmployeeTask(employeeTaskViewModel); var employeeTaskDTO = MapModelToEmployeeTaskDTO(employeeTask); return(employeeTaskDTO); }
public IActionResult List() { var vm = new EmployeeTaskViewModel { TaskAssignments = context.TaskAssignments.Where(ta => ta.EmployeeId == HttpContext.Session.GetInt32("currentUserId")).Include(t => t.Task).Include(ta => ta.Task.Job).ToList() }; return(View(vm)); }
public ActionResult UpdateTask(EmployeeTaskViewModel taskModel) { EmployeeTask task = empTaskRepository.FindByTaskId(taskModel.TaskID); task.Efforts = taskModel.HoursSpent; empTaskRepository.InsertOrUpdate(task); empTaskRepository.Save(); return(View(new GridModel(GetEmployeeTask()))); }
public IHttpActionResult DeleteEmployeeTaskDTO(EmployeeTaskViewModel employeeTaskViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _employeeServices.DeleteEmployeeTask(employeeTaskViewModel); return(Ok()); }
public async Task <ActionResult> Create() { EmployeeTaskViewModel employeeTaskViewModel = new EmployeeTaskViewModel { Employees = await _repoEmp.GetAllEmployeesAsync(), Tasks = await _repoTask.GetAllTasksAsync() }; return(View(employeeTaskViewModel)); }
public IHttpActionResult UpdateEmployeeTask(EmployeeTaskViewModel employeeTaskViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var personTaskDTO = _employeeServices.UpdateEmployeeTaskDetails(employeeTaskViewModel); return(Ok(personTaskDTO)); }
public void DeleteEmployeeTask(EmployeeTaskViewModel employeeTaskViewModel) { var DateNow = DateTime.Now; var employee = Context.EmployeeTask. Where(d => d.IsActive == true && d.EmployeeTaskId == employeeTaskViewModel.EmployeeTaskId).FirstOrDefault(); var employeetask = new EmployeeTask(); employee.UpdatedBy = "Admin"; employee.DateUpdated = DateTime.Now; employee.IsActive = false; Context.SaveChanges(); }
public IActionResult ConcreteForm(int id) { var task = _employeeTaskRepository.GetTaskById(id); if (task == null) { return(RedirectToAction("ConcreteForm", "Administration")); } var newTask = new EmployeeTaskViewModel { TaskId = task.Id }; return(RedirectToAction("PickEmployee", newTask)); }
private EmployeeTask UpdateEmployeeTask(EmployeeTaskViewModel employeeTaskViewModel) { var dateNow = DateTime.Now; var employeeTask = Context.EmployeeTask. Where(d => d.IsActive == true && d.EmployeeTaskId == employeeTaskViewModel.EmployeeTaskId) .FirstOrDefault(); employeeTask.EmployeeTaskName = employeeTaskViewModel.EmployeeTaskName; employeeTask.EmployeeTaskDetails = employeeTaskViewModel.EmployeeTaskDetails; employeeTask.DateUpdated = dateNow; employeeTask.UpdatedBy = "Admin"; Context.SaveChanges(); return(employeeTask); }
public async Task <ActionResult> Create(EmployeeTaskViewModel employeeTaskViewModel) { if (ModelState.IsValid) { await _repoTask.CreateEmployeeTaskAsync(employeeTaskViewModel.TaskSelectedValue, employeeTaskViewModel.EmployeeSelectedValue); return(RedirectToAction("Index")); } else { employeeTaskViewModel.Employees = await _repoEmp.GetAllEmployeesAsync(); return(View(employeeTaskViewModel)); } }
public async Task <IActionResult> PickEmployee(EmployeeTaskViewModel newTask) { var emp = await _userManager.GetUsersInRoleAsync("Employee"); if (emp != null) { var employees = new List <EmployeeTaskViewModel>(); foreach (var employee in emp) { var mapEmp = _mapper.MapApplicationUserToEmployeeTaskViewModel(employee); mapEmp.TaskId = newTask.TaskId; employees.Add(mapEmp); } return(View(employees)); } else { _logger.LogWarning("Can't find employees in Employee role, AdministrationController PickEmployee method"); } return(View()); }
public IActionResult NewTask(EmployeeTaskViewModel model) => View(model);