Created
June 19, 2018 06:11
-
-
Save merken/2fdf4d15aa983aacfcfd1efef2d9e22d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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