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); } }
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); } }