public async Task <IActionResult> Create([Bind("Amount,EmployeeId,UnitPrice,ProjectId")] ProjectDrivingViewModel projectDrivingViewModel) { if (ModelState.IsValid) { //_context.Add(projectDrivingViewModel); //await _context.SaveChangesAsync(); await _employeeService.AddAsync(ProjectDrivingMapper.Map(projectDrivingViewModel)); return(RedirectToAction("details", "project", new { id = projectDrivingViewModel.ProjectId })); } //ViewData["EmployeeId"] = new SelectList(_context.Employees, "Id", "Id", projectDrivingViewModel.EmployeeId); return(RedirectToAction("details", "project", new { id = projectDrivingViewModel.ProjectId })); }
public void AddProjectDrivingToProject([FromBody] ProjectDrivingDto value) { _employeeService.Create(ProjectDrivingMapper.Map(value)); }