Ejemplo n.º 1
0
        public async Task <IActionResult> AddProjectEmployeeToProject(List <EstWorkingHoursEmployeeViewModel> items)
        {
            try
            {
                var projectEmployees = items.Where(x => x.EstWorkingHours > 0).Select(x => new ProjectEmployeeViewModel()
                {
                    EmployeeId      = x.Id,
                    ProjectId       = x.ProjectId,
                    EstWorkingHours = x.EstWorkingHours,
                });
                await _employeeService.AddProjectEmployeeAsync(ProjectEmployeeMapper.Map(projectEmployees).ToList()).ConfigureAwait(false);

                return(RedirectToAction("details", "project", new { id = items[0].ProjectId }));
            }
            catch (Exception)
            {
                ErrorViewModel model = new ErrorViewModel {
                    RequestId = "Medarbejderen kunne ikke tilknyttes projektet"
                };
                return(View("Error", model));
            }
        }
Ejemplo n.º 2
0
 public void AddProjectEmployeeToProject([FromBody] ProjectEmployeeDto value)
 {
     _employeeService.CreateProjectEmployee(ProjectEmployeeMapper.Map(value));
 }