示例#1
0
        public EmployeeTaskDTO UpdateEmployeeTaskDetails(EmployeeTaskViewModel employeeTaskViewModel)
        {
            var employeeTask    = UpdateEmployeeTask(employeeTaskViewModel);
            var employeeTaskDTO = MapModelToEmployeeTaskDTO(employeeTask);

            return(employeeTaskDTO);
        }
示例#2
0
        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())));
        }
示例#4
0
        public IHttpActionResult DeleteEmployeeTaskDTO(EmployeeTaskViewModel employeeTaskViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _employeeServices.DeleteEmployeeTask(employeeTaskViewModel);
            return(Ok());
        }
示例#5
0
        public async Task <ActionResult> Create()
        {
            EmployeeTaskViewModel employeeTaskViewModel = new EmployeeTaskViewModel
            {
                Employees = await _repoEmp.GetAllEmployeesAsync(),
                Tasks     = await _repoTask.GetAllTasksAsync()
            };

            return(View(employeeTaskViewModel));
        }
示例#6
0
        public IHttpActionResult UpdateEmployeeTask(EmployeeTaskViewModel employeeTaskViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var personTaskDTO = _employeeServices.UpdateEmployeeTaskDetails(employeeTaskViewModel);

            return(Ok(personTaskDTO));
        }
示例#7
0
        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();
        }
示例#8
0
        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));
        }
示例#9
0
        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);
        }
示例#10
0
        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));
            }
        }
示例#11
0
        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());
        }
示例#12
0
 public IActionResult NewTask(EmployeeTaskViewModel model) => View(model);