示例#1
0
        public async Task InsertOrMergeTableEntityAsync(JobScheduleEntity js)
        {
            var account = CloudStorageAccount.Parse(_azureConfiguration.StorageConnectionString);
            var client  = account.CreateCloudTableClient(new TableClientConfiguration());
            var table   = client.GetTableReference("JobScheduler");

            TableOperation insertOperation = TableOperation.InsertOrMerge(js);
            await table.ExecuteAsync(insertOperation);
        }
示例#2
0
        public async Task <ActionResult> Edit(JobScheduleEntity jobScheduleEntity)
        {
            try
            {
                var airCons = await _airConService.GetAirCons();

                jobScheduleEntity.Location = airCons.FirstOrDefault(x => x.Id == jobScheduleEntity.AirConId).Location;
                await _schedulerService.InsertOrMergeTableEntityAsync(jobScheduleEntity);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
示例#3
0
        public async Task <ActionResult> Create(JobScheduleEntity jobScheduleEntity)
        {
            try
            {
                var airCons = await _airConService.GetAirCons();

                jobScheduleEntity.PartitionKey = Guid.NewGuid().ToString();
                jobScheduleEntity.RowKey       = Guid.NewGuid().ToString();
                jobScheduleEntity.Timestamp    = DateTimeOffset.Now;
                jobScheduleEntity.JobType      = typeof(AirConJob);
                jobScheduleEntity.Location     = airCons.FirstOrDefault(x => x.Id == jobScheduleEntity.AirConId).Location;

                await _schedulerService.InsertOrMergeTableEntityAsync(jobScheduleEntity);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }