public UnitOverviewViewModel GetUnitOverviewData(UnitOverviewViewModel unit) { unit.JobName = Enum.GetName(typeof(Enums.Jobs), unit.JobID); unit.JobName = unit.JobName.Contains("Onion") ? "Onion Knight" : unit.JobName; unit.JobPortraitPath = String.Format("/img/Jobs/{0}_{1}_Portrait.png", unit.JobName.Contains("Onion") ? "OnionKnight" : unit.JobName, unit.GenderName); unit.JobName = string.Concat(unit.JobName.Select(m => Char.IsUpper(m) ? " " + m : m.ToString())).Trim(); unit.GenderName = Enum.GetName(typeof(Enums.Gender), unit.Gender); unit.AttributeDigits = new UnitOverviewHpMpViewModel { HpDigits = unit.MaxHP.ToString().ToCharArray(), MpDigits = unit.MaxMP.ToString().ToCharArray(), ExperienceDigits = unit.Experience < 10 ? ("0" + unit.Experience.ToString()).ToCharArray() : unit.Experience.ToString().ToCharArray(), LevelDigits = unit.Level < 10 ? ("0" + unit.Level.ToString()).ToCharArray() : unit.Level.ToString().ToCharArray(), PositionDigits = unit.Position < 10 ? ("0" + unit.Position.ToString()).ToCharArray() : unit.Position.ToString().ToCharArray() }; return(unit); }
public ActionResult GetUnitOverviewPartial(UnitOverviewViewModel unit) { unit.JobName = Enum.GetName(typeof(Jobs), unit.JobID); unit.JobName = unit.JobName.Contains("Onion") ? "Onion Knight" : unit.JobName; unit.JobPortraitPath = String.Format("/Content/Images/Jobs/{0}_{1}_Portrait.png", unit.JobName.Contains("Onion") ? "OnionKnight" : unit.JobName, unit.GenderName); unit.JobName = string.Concat(unit.JobName.Select(m => Char.IsUpper(m) ? " " + m : m.ToString())).Trim(); unit.GenderName = Enum.GetName(typeof(Gender), unit.Gender); unit.AttributeDigits = new UnitOverviewHpMpViewModel { HpDigits = unit.MaxHP.ToString().ToCharArray(), MpDigits = unit.MaxMP.ToString().ToCharArray(), ExperienceDigits = unit.Experience < 10 ? ("0" + unit.Experience.ToString()).ToCharArray() : unit.Experience.ToString().ToCharArray(), LevelDigits = unit.Level < 10 ? ("0" + unit.Level.ToString()).ToCharArray() : unit.Level.ToString().ToCharArray(), PositionDigits = unit.Position < 10 ? ("0" + unit.Position.ToString()).ToCharArray() : unit.Position.ToString().ToCharArray() }; return(PartialView("~/Views/Home/_UnitOverviewStatusPartial.cshtml", unit)); }