public async Task <IActionResult> Create(string executorId) { var currentEmployeeId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); this.ViewData["ExecutorId"] = executorId; this.ViewData["AssignorId"] = currentEmployeeId; this.ViewData["AssignorName"] = await this.employeesService.GetEmployeeFullNameByIdAsync(currentEmployeeId); var inputModel = new AssignmentCreateInputModel(); return(View(inputModel)); }
public async Task <IActionResult> Create(AssignmentCreateInputModel input) { if (!ModelState.IsValid) { var currentEmployeeId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); this.ViewData["AssignorId"] = currentEmployeeId; this.ViewData["AssignorName"] = await this.employeesService.GetEmployeeFullNameByIdAsync(currentEmployeeId); return(View(input)); } var inputDto = input.To <AssignmentCreateDto>(); await this.assignmentsService.CreateAssignmentAsync(inputDto); return(RedirectToAction("FromMe")); }