public static IResult Show(StatisticMapping statMap) { ShowStatisticViewModel stat = null; if (statMap.Statistic is Attribute attrib) { stat = new ShowAttributeViewModel(attrib.Name, attrib.Description, attrib.AliasesArray, attrib.Order, statMap?.StatisticValue.Value, statMap?.StatisticValue.IsProficient, statMap?.StatisticValue.Proficiency); } else if (statMap.Statistic is Skill s) { var attribViewModel = new ShowAttributeViewModel(s.Attribute.Name, s.Attribute.Description, s.Attribute.AliasesArray, s.Attribute.Order, null, null, null); stat = new ShowSkillViewModel(s.Name, s.Description, s.AliasesArray, s.Order, statMap?.StatisticValue.Value, statMap?.StatisticValue.IsProficient, statMap?.StatisticValue.Proficiency, s.MinimumValue, attribViewModel); } else { return(StatisticResult.StatisticNotFound()); } var message = $"**{stat.Name}:** {stat.Value?.ToString() ?? "N/A"}"; if (stat.IsProficient.HasValue && stat.IsProficient.Value) { message += "*"; } return(new StatisticResult(message, viewModel: stat)); }
public SkillController(ISkillRepository skillRepository) { _showViewModel = new ShowSkillViewModel(); _addViewModel = new AddSkillViewModel(); _purposeModel = new PurposeSkillViewModel(); _skillRepository = skillRepository; }