public void DeleteTaskDevelopment(int projectDevelopmentId, int taskDevelopmentId) { var spec = new SharpRepository.Repository.Specifications.Specification <Project_Development>(p => p.Id == projectDevelopmentId); spec.FetchStrategy.Include(p => p.Task_Development); var projectDevelopment = _repoProjectDevelopment.Find(spec); if (projectDevelopment == null) { throw new InvalidOperationException("No project with the provided identity was found"); } var taskDevelopment = projectDevelopment.Task_Development.FirstOrDefault(t => t.Id == taskDevelopmentId); if (taskDevelopment == null) { throw new InvalidOperationException("No task with the provided identity was found"); } _repoTaskDevelopment.Delete(taskDevelopment); }
public SupportStaffShift Insert(DateTime start, DateTime end, string description, int empId, string color, string title, int recurrenceId, string recurrenceException, string recurrenceRule) { var entity = new SupportStaffShift { StartTime = start, EndTime = end, Description = description, EmployeeInSupportPositionId = empId, Color = color, Title = title, RecurrenceId = recurrenceId, RecurrenceException = recurrenceException, RecurrenceRule = recurrenceRule }; var specification = new SharpRepository.Repository.Specifications.Specification <EmployeeInPosition>(e => e.Id == empId); specification.FetchStrategy = specification.FetchStrategy.Include(e => e.Employee); var employeeInSupportPosition = _repoEmpInSupportPos.Find(specification); _repoSupportStaffShift.Add(entity); return(entity); }