Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
bpjohannessen authored Nov 20, 2018
2 parents ddb7923 + 15117e1 commit 3d38dda
Show file tree
Hide file tree
Showing 26 changed files with 891 additions and 112 deletions.
2 changes: 1 addition & 1 deletion MuscleWeb/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}\\bin\\Debug\\netcoreapp1.1\\MuscleWeb.dll",
"program": "${workspaceRoot}\\bin\\Debug\\netcoreapp2.1\\MuscleWeb.dll",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
Expand Down
28 changes: 7 additions & 21 deletions MuscleWeb/Controllers/ArteryDetails.cs
Original file line number Diff line number Diff line change
@@ -1,42 +1,28 @@
using System.Collections.Generic;
public class ArteryDetails
{

/// <summary>
/// Gets or sets the Id (non-medical) of the artery.
/// </summary>
/// <returns></returns>

//public long muscle_id { get; set; }
public long Id { get; set; }

/// <summary>
/// Gets or sets the name of the artery.
/// </summary>
/// </summary>
//public string Name { get; set; }
public string Artery_Name { get; set; }

/// <summary>
/// Gets or sets the Latin name of the artery.
/// </summary>
/// </summary>
//public string LatinName { get; set; }



//public string artery_latinName { get; set; }
public string Artery_latinName { get; set; }

/// <summary>
/// Gets or sets the muscles supplied by this artery.
/// </summary>

public long Id { get; set; }

public long Link_Muscle_Id { get; set; }

public long Artery_Id { get; set; }

public string Artery_Name { get; set; }

public string Artery_latinName { get; set; }

/// </summary>
public ICollection<ArteryMuscle> ArteryMuscles { get; set; }


}
14 changes: 12 additions & 2 deletions MuscleWeb/Controllers/ArteryMuscle.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
public class ArteryMuscle {


/// <summary>
/// Gets or sets the artery id
/// </summary>
public long Id { get; set; }

/// <summary>
/// Gets or sets the artery name (English)
/// </summary>
public string Name { get; set; }
public string LatinName { get; set; }

/// <summary>
/// Gets or sets the artery name (Latin)
/// </summary>
public string LatinName { get; set; }

}
8 changes: 2 additions & 6 deletions MuscleWeb/Controllers/ArteryMusclesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ public ArteryMusclesController(IDbConnection connection)
[HttpGet("{id}")]
public ArteryDetails Get(int id)
{
string sql = Sql.Get("ArteryById");
//Edited from Single() to SingleOrDefault()
//Bernhard: Dette tror jeg er noe kødd med!
var result = connection.Read<ArteryDetails>(sql, new {Id = id}).FirstOrDefault();

return result;
string sql = Sql.Get("ArteryById");
return connection.Read<ArteryDetails>(sql, new {Id = id}).SingleOrDefault();
}
}
56 changes: 20 additions & 36 deletions MuscleWeb/Controllers/MuscleDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@ public class MuscleDetails
public string Comment { get; set; }

/// <summary>
/// Gets or sets the artery id of the muscle.
/// </summary>
public long Artery_Id { get; set; }

/// <summary>
/// Gets or sets the artery name of the muscle.
/// </summary>
public string Artery { get; set; }

/// <summary>
/// Gets or sets the vein id of the muscle.
/// </summary>
public long Vein_Id { get; set; }
Expand All @@ -67,7 +57,7 @@ public class MuscleDetails
/// </summary>
public string Vein { get; set; }

/// <summary>
/// <summary>
/// Gets or sets the nerve id of the muscle.
/// </summary>
public long Nerve_Id { get; set; }
Expand All @@ -77,36 +67,30 @@ public class MuscleDetails
/// </summary>
public string Nerve { get; set; }

// /// <summary>
// /// Gets or sets the arteries that supplies blood to this muscle.
// /// </summary>
// /// <returns></returns>
// public ICollection<Artery> Arteries {get;set;}
/// <summary>
/// Gets or sets a list of arteries that supplies the muscle
/// </summary>
/// <returns></returns>
public ICollection<MuscleArtery> MuscleArteries { get; set; }

/// <summary>
/// Gets or sets a list of muscle groups that represents the hierarchy of muscle groups
/// starting with the top level group as the first entry in the list.
/// Gets or sets a list of veins that drains the muscle
/// </summary>
/// <returns></returns>

// For testing - should return id of artery
public long Arteries { get; set; }


// Should output something like
// "MuscleArteries": [
// {
// "id": 1,
// "name": "Temporal artery",
// "latinName": "A. temporalis"
// },
// {
// "id": 2,
// "name": "Femoral artery",
// "latinName": "A. femoralis"
// }
// ]
public ICollection<MuscleArtery> MuscleArteries { get; set; }
public ICollection<MuscleVein> MuscleVeins { get; set; }

/// <summary>
/// Gets or sets a list of nerves that supplies the muscle
/// </summary>
/// <returns></returns>

public ICollection<MuscleNerve> MuscleNerves { get; set; }

/// <summary>
/// Gets or sets a list of muscle groups that represents the hierarchy of muscle groups
/// starting with the top level group as the first entry in the list.
/// </summary>
/// <returns></returns>
public ICollection<MuscleGroup> MuscleGroups { get; set; }
}
18 changes: 18 additions & 0 deletions MuscleWeb/Controllers/MuscleNerve.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
public class MuscleNerve {

/// <summary>
/// Gets or sets the nerve id
/// </summary>
public long Id { get; set; }

/// <summary>
/// Gets or sets the nerve name (English)
/// </summary>
public string Name { get; set; }

/// <summary>
/// Gets or sets the nerve name (Latin)
/// </summary>
public string LatinName { get; set; }

}
18 changes: 18 additions & 0 deletions MuscleWeb/Controllers/MuscleVein.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
public class MuscleVein {

/// <summary>
/// Gets or sets the vein id
/// </summary>
public long Id { get; set; }

/// <summary>
/// Gets or sets the vein name (English)
/// </summary>
public string Name { get; set; }

/// <summary>
/// Gets or sets the vein name (Latin)
/// </summary>
public string LatinName { get; set; }

}
28 changes: 28 additions & 0 deletions MuscleWeb/Controllers/NerveDetails.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Collections.Generic;
public class NerveDetails
{

/// <summary>
/// Gets or sets the Id (non-medical) of the nerve.
/// </summary>
/// <returns></returns>
public long Id { get; set; }

/// <summary>
/// Gets or sets the name of the nerve.
/// </summary>
//public string Name { get; set; }
public string Nerve_Name { get; set; }

/// <summary>
/// Gets or sets the Latin name of the nerve.
/// </summary>
//public string LatinName { get; set; }
public string Nerve_latinName { get; set; }

/// <summary>
/// Gets or sets the muscles supplied by this nerve.
/// </summary>
public ICollection<NerveMuscle> NerveMuscles { get; set; }

}
18 changes: 18 additions & 0 deletions MuscleWeb/Controllers/NerveMuscle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
public class NerveMuscle {

/// <summary>
/// Gets or sets the nerve id
/// </summary>
public long Id { get; set; }

/// <summary>
/// Gets or sets the nerve name (English)
/// </summary>
public string Name { get; set; }

/// <summary>
/// Gets or sets the nerve name (Latin)
/// </summary>
public string LatinName { get; set; }

}
23 changes: 23 additions & 0 deletions MuscleWeb/Controllers/NerveMusclesController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using System.Data;
using DbReader;
using System.Linq;

[Route("api/[controller]")]
public class NerveMusclesController : Controller
{
private IDbConnection connection;

public NerveMusclesController(IDbConnection connection)
{
this.connection = connection;
}

[HttpGet("{id}")]
public NerveDetails Get(int id)
{
string sql = Sql.Get("NerveById");
return connection.Read<NerveDetails>(sql, new {Id = id}).SingleOrDefault();
}
}
28 changes: 28 additions & 0 deletions MuscleWeb/Controllers/VeinDetails.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Collections.Generic;
public class VeinDetails
{

/// <summary>
/// Gets or sets the Id (non-medical) of the vein.
/// </summary>
/// <returns></returns>
public long Id { get; set; }

/// <summary>
/// Gets or sets the name of the vein.
/// </summary>
//public string Name { get; set; }
public string Vein_Name { get; set; }

/// <summary>
/// Gets or sets the Latin name of the vein.
/// </summary>
//public string LatinName { get; set; }
public string Vein_latinName { get; set; }

/// <summary>
/// Gets or sets the muscles supplied by this vein.
/// </summary>
public ICollection<VeinMuscle> VeinMuscles { get; set; }

}
18 changes: 18 additions & 0 deletions MuscleWeb/Controllers/VeinMuscle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
public class VeinMuscle {

/// <summary>
/// Gets or sets the vein id
/// </summary>
public long Id { get; set; }

/// <summary>
/// Gets or sets the vein name (English)
/// </summary>
public string Name { get; set; }

/// <summary>
/// Gets or sets the vein name (Latin)
/// </summary>
public string LatinName { get; set; }

}
23 changes: 23 additions & 0 deletions MuscleWeb/Controllers/VeinMusclesController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using System.Data;
using DbReader;
using System.Linq;

[Route("api/[controller]")]
public class VeinMusclesController : Controller
{
private IDbConnection connection;

public VeinMusclesController(IDbConnection connection)
{
this.connection = connection;
}

[HttpGet("{id}")]
public VeinDetails Get(int id)
{
string sql = Sql.Get("VeinById");
return connection.Read<VeinDetails>(sql, new {Id = id}).SingleOrDefault();
}
}
3 changes: 3 additions & 0 deletions MuscleWeb/MuscleWeb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
<EmbeddedResource Include="SqlQueries\MusclesByGroupId.sql" />
<EmbeddedResource Include="SqlQueries\MuscleGroupHierarchy.sql" />
<EmbeddedResource Include="SqlQueries\ArteryById.sql" />
<EmbeddedResource Include="SqlQueries\VeinById.sql" />
<EmbeddedResource Include="SqlQueries\NerveById.sql" />

</ItemGroup>
</Project>
Loading

0 comments on commit 3d38dda

Please sign in to comment.