コード例 #1
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
            ILogger log)
        {
            DeployDBContext    _context           = new DeployDBContext();
            AzureStorageConfig azureStorageConfig = new AzureStorageConfig();

            azureStorageConfig.AccountKey       = Environment.GetEnvironmentVariable("StorageName");
            azureStorageConfig.AccountKey       = Environment.GetEnvironmentVariable("StorageKey");
            azureStorageConfig.ConnectionString = Environment.GetEnvironmentVariable("StorageConnection");
            TenantParameters _tennantService = new TenantParameters(_context, azureStorageConfig);

            string id    = req.Query["id"];
            int    value = Int16.Parse(id);
            await _tennantService.GetDeploy(value);

            //var deployTypes = _context.DeployTypes.Where(d => d.DeployTypeId == value).FirstOrDefault();

            string  requestBody = await new StreamReader(req.Body).ReadToEndAsync();
            dynamic data        = JsonConvert.DeserializeObject(requestBody);

            id = id ?? data?.name;


            return(null);

            //return id != null
            //    ? (ActionResult)new OkObjectResult($"Hello, James")
            //    : new BadRequestObjectResult("Please pass a name on the query string or in the request body");
        }
コード例 #2
0
        public async Task <IActionResult> GetDeploy(int Id)
        {
            var deployTypes = _context.DeployTypes.Include(d => d.Tennants).Where(d => d.DeployTypeID == Id).FirstOrDefault();
            await _service.GetDeploy(Id);

            return(RedirectToAction("Index", "DeployTypes", new { id = deployTypes.TennantID }));
        }