This project solves the problems posed in this pdf.
https://drive.google.com/open?id=1PX4U_6829m6dR_fBjSpygfGNISqMi2ZI
I solved the problems in two ways. First way was to create triangle objects in a list with their coordinates and labels then use LINQ to query the list. This method throws exceptions if the parameters are out of range or invalid. Second way uses math and regular expressions to figure out the row, column, and position (upper / lower) of the triangle based on the provided parameters. This way can calculate for infinite columns and 26 (alphabet restricted) rows.
First way using LINQ entities.
Using LINQ - Get all Triangles
https://localhost:44384/api/values/AllTriangles
Using LINQ - Get a triangle by label (task 1A)
https://localhost:44384/api/values/GetByLabel?label=C6
Using LINQ - Get a triangle by coordinates (task 1B)
https://localhost:44384/api/values/GetByCoordinates?aX=30&aY=50&bX=30&bY=60&cX=40&cY=60
Second way using math and a regular expression.
Caclulate coordinates by label (task 1A)
https://localhost:44384/api/values/GetByLabelInference?label=A2
Calculate label by coordinates (task 1B)
https://localhost:44384/api/values/GetByInferenceCoordinates?aX=40&aY=30&bX=40&bY=40&cX=50&cY=40
The following request examples show how we can go beyond the grid in the sample and get any row (A-Z) and column.
https://localhost:44384/api/values/GetByLabelInference?label=S448