public async Task <IActionResult> Add(AddReportDto model) { if (ModelState.IsValid) { _reportService.Save(new Report() { TaskId = model.TaskId, Description = model.Definition, Detail = model.Detail }); var adminUserList = await _userManager.GetUsersInRoleAsync("Admin"); var activeUser = await GetSingInUser(); foreach (var adminUser in adminUserList) { _notificationService.Save(new Notification() { Description = $"{activeUser.Name} {activeUser.Surname} yeni bir rapor yazdı.", AppUserId = adminUser.Id, }); } return(RedirectToAction("Index")); } return(View()); }
public IActionResult Add(int taskId) { var task = _taskService.GetTaskWithUrgent(taskId); AddReportDto addReportDto = new AddReportDto(); addReportDto.TaskId = taskId; addReportDto.Task = task; return(View(addReportDto)); }