public async Task <ActionResult> AddTask(ProjectTask task) { if (ModelState.IsValid) { _repositoryTask.Create(task); var e = _repositoryEmployee.Find(f => f.EmployeeId.Equals(task.ExecuterId)); var employee = e.FirstOrDefault(); //IdentityMessage message = new IdentityMessage(); //message.Body = string.Format(employee.NickName + " на Вас возложена новая задача!!!"); //message.Destination = employee.Email; //message.Subject = "Dream team"; //EmailService em = new EmailService(); //await em.SendAsync(message); return(RedirectToAction("ViewEmployeeTasks", employee)); } else { var e = _repositoryEmployee.Find(f => f.EmployeeId.Equals(task.ExecuterId)); var employee = e.FirstOrDefault(); return(RedirectToAction("ViewEmployeeTasks", employee)); } }