/// <summary> /// Удаляет проект/работу по Id /// </summary> /// <param name="id"></param> /// <param name="onDeleteEvent"></param> public void DeleteProject(int id, int startID) { foreach (var p in GetProjectsByParrentId(id)) { DeleteProject(p.IdProject, startID); } foreach (var t in cont.Team.Where(team => team.Project.IdProject == id)) { //Отправить уведомление об отмене работы. var sender = new MailSender.MailSender(); sender.Send(new WordCanceledMail(t.Person.email, GetProjectById(id))); cont.Team.Remove(t); } cont.Project.Remove(cont.Project.Find(id)); if (id == startID) { cont.SaveChanges(); } }
public Worker() { Capturer = new ScreenCapturer(); sender = new MailSender.MailSender(); }