-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from ucdavis/fix/roletemplate-performance
Fix/roletemplate performance
- Loading branch information
Showing
5 changed files
with
65 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Viper.Areas.RAPS.Models | ||
{ | ||
public class RoleSimplified | ||
{ | ||
public int RoleId { get; set; } | ||
public string FriendlyName { get; set; } = null!; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Viper.Models.RAPS; | ||
|
||
namespace Viper.Areas.RAPS.Models | ||
{ | ||
/* Streamlined object to return from the RoleTemplate REST calls */ | ||
public class RoleTemplateSimplified | ||
{ | ||
public int RoleTemplateId { get; set; } | ||
|
||
public string TemplateName { get; set; } = null!; | ||
|
||
public string Description { get; set; } = null!; | ||
|
||
public virtual ICollection<RoleSimplified> Roles { get; set; } = new List<RoleSimplified>(); | ||
|
||
public RoleTemplateSimplified() { } | ||
public RoleTemplateSimplified(RoleTemplate rt) | ||
{ | ||
RoleTemplateId = rt.RoleTemplateId; | ||
TemplateName = rt.TemplateName; | ||
Description = rt.Description; | ||
Roles = new List<RoleSimplified>(); | ||
foreach (var rtr in rt.RoleTemplateRoles) | ||
{ | ||
Roles.Add(new RoleSimplified() | ||
{ | ||
RoleId = rtr.Role.RoleId, | ||
FriendlyName = rtr.Role.FriendlyName | ||
}); | ||
} | ||
} | ||
} | ||
|
||
} |
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