$GENERATED_CS_COMMENT using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Swashbuckle.AspNetCore.Annotations; using Microsoft.AspNetCore.Authorization; using Swashbuckle.AspNetCore.SwaggerGen; using Newtonsoft.Json; using ${env['packagename']}.Attributes; using ${env['packagename']}.Models; using ${env['packagename']}.Controllers; using ${env['packagename']}.Services; namespace ${env['packagename']}.Implementations { /// /// public class RegularApiImplementation : RegularApiController { private readonly IDbService _dbService; public RegularApiImplementation(IDbService dbService) { _dbService = dbService; } #for $operation in $operations #if $operation['method'] == 'get' /// /// $operation['description'] /// public override async Task ${operation['func']}( #slurp #if $operation['paramsInputTypes'] #set $sep = "" #for $paramsInputType in $operation['paramsInputTypes'] $sep [FromRoute (Name = "$paramsInputType['name']")] #slurp #if $paramsInputType['required'] [Required] #slurp #end if $paramsInputType['type'] $paramsInputType['name'] #slurp #set $sep = "," #end for #elif $operation['bodyInputType'] [FromBody]$operation['bodyInputType']['csName'] $operation['bodyInputType']['apiName'] #slurp #end if ) { List<$operation['resultType']['csName']> res = await _dbService.JustDoSomething<$operation['resultType']['csName']>("Hello ${operation['func']}"); // Statement: #if not $operation['statement'] // SELECT #set $sep = "" #for $property in $types[$operation['resultType']['apiName']]['properties'] // $sep$property['sqlName'] #set $sep = "," #end for // FROM $types[$operation['resultType']['apiName']]['sqlName']; #else // $operation['statement'] #end if #if $operation['bodyInputType'] // Input type mapping: $operation['bodyInputType']['apiName'] -> $operation['bodyInputType']['csName'] #for $property in $types[$operation['bodyInputType']['apiName']]['properties'] // $property['sqlName'] -> $property['csName'] #end for #end if // Model object to use: $operation['resultType']['apiName'] -> $operation['resultType']['csName'] // Properties to map result: #for $property in $types[$operation['resultType']['apiName']]['properties'] // $property['sqlName'] -> $property['csName'] #end for #if $operation['isList'] // result must be mapped in list #end if return new ObjectResult(res); } #elif $operation['method'] == 'post' // INSERT #elif $operation['method'] == 'put' // UPDATE #elif $operation['method'] == 'delete' // DELETE #else #raise Exception('invalid method') #end if #end for } }