Esempio n. 1
0
        public async Task <List <int> > DeleteCheckPoint(List <int> checkpointsId)
        {
            List <int> unDeletedCheckpoints = new List <int>();

            foreach (int checkpointId in checkpointsId)
            {
                var checkpoint = await checkpointRepository.GetCheckPointById(checkpointId);

                if (checkpoint == null)
                {
                    throw new Exception("checkpoint not exist");
                }

                if (checkpoint.SubTasks.Count > 0)
                {
                    unDeletedCheckpoints.Add(checkpointId);
                }
                else
                {
                    await checkpointRepository.DeleteCheckpointById(checkpointId);
                }
            }

            await checkpointRepository.SaveChanges();

            return(unDeletedCheckpoints);
        }