public async void StoreTask(int[,] matrix, int userId)
        {
            int taskId = await TaskRepository.CreateNewTask(matrix.GetLength(0), userId);

            if (Directory.Exists(@"C:\Tasks"))
            {
                if (!File.Exists($@"C:\Tasks\{taskId}.dat"))
                {
                    using (var writer = new BinaryWriter(File.Open($@"C:\Tasks\{taskId}.dat", FileMode.OpenOrCreate)))
                    {
                        writer.Write(ByteConverter.GetBytes(matrix));
                    }
                }
                else
                {
                    return;
                }
            }
            else
            {
                Directory.CreateDirectory(@"C:\Tasks");
                using (var writer = new BinaryWriter(File.Open($@"C:\Tasks\{taskId}.dat", FileMode.OpenOrCreate)))
                {
                    writer.Write(ByteConverter.GetBytes(matrix));
                }
            }
        }
예제 #2
0
 // POST: api/Task
 public void Post(ProjectTask value)
 {
     repository.CreateNewTask(value);
 }