コード例 #1
0
        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);
 }