Skip to content

Instantly share code, notes, and snippets.

@merken
Created June 19, 2018 06:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save merken/2fdf4d15aa983aacfcfd1efef2d9e22d to your computer and use it in GitHub Desktop.
Save merken/2fdf4d15aa983aacfcfd1efef2d9e22d to your computer and use it in GitHub Desktop.
[Route("api/[controller]")]
[ApiController]
public class InvoicesController : ControllerBase
{
private readonly IEnumerable<IInvoicingService> invoicingServices;
public InvoicesController(IEnumerable<IInvoicingService> invoicingServices)
{
this.invoicingServices = invoicingServices;
}
[HttpGet]
public ActionResult<string> Get(float hoursPerformed)
{
var builder = new StringBuilder();
builder.AppendLine($"Invoice {DateTime.Now.ToShortDateString()}");
builder.AppendLine($"");
builder.AppendLine($"Hours performed : {hoursPerformed}");
builder.AppendLine($"");
foreach (var service in invoicingServices)
{
builder.AppendLine($"{service.CreateInvoice(hoursPerformed)}");
}
builder.AppendLine($"---------------------");
return builder.ToString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment