コード例 #1
0
        public async Task CreateAsync(FixItTask task, HttpPostedFileBase photo)
        {
            if (task.Notes.Contains("fail me"))
            {
                throw new Exception("Task cannot be created");
            }
            
            task.PhotoUrl = await photoService.UploadPhotoAsync(photo);

            if (ConfigurationManager.AppSettings["UseQueues"] == "true")
            {
                await queueManager.SendMessageAsync(task);
            }
            else
            {
                await fixItRepository.CreateAsync(task);
            }
        }
コード例 #2
0
        public async Task CreateAsync(FixItTask task, HttpPostedFileBase photo)
        {
            var stopWatch = new Stopwatch();
            stopWatch.Start();
            try
            {
                await service.CreateAsync(task, photo);
            }
            finally
            {
                stopWatch.Stop();

                var properties = new Dictionary<string, string>
                                 {
                                     { "Title", task.Title },
                                     { "Owner", task.Owner }
                                 };
                TrackEvent("Create", stopWatch.Elapsed, properties);
            }
        }