SelectListViewModel tostring fix
Fix for links in the details to the right controller
This commit is contained in:
@@ -10,7 +10,7 @@ namespace MileageTraker.Web.ViewModels
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (Selected > 0)
|
||||
if (Selected.HasValue && Selected.Value > 0 && Available != null)
|
||||
{
|
||||
var selected = Available.FirstOrDefault(i => i.Value == Selected.ToString());
|
||||
if (selected != null)
|
||||
@@ -18,6 +18,10 @@ namespace MileageTraker.Web.ViewModels
|
||||
return selected.Text;
|
||||
}
|
||||
}
|
||||
else if (Selected.HasValue)
|
||||
{
|
||||
return Selected.ToString();
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
</div>
|
||||
|
||||
<div class="center-content btn-toolbar">
|
||||
@Html.ActionLink("Edit", "Edit", new { id = Model.VehicleRecallId }, new { @class = "btn" })
|
||||
@Html.ActionLink("Delete", "Delete", new { id = Model.VehicleId }, new { @class = "btn" })
|
||||
@Html.ActionLink("Edit", "Edit", "VehicleRecall", new { id = Model.VehicleRecallId }, new { @class = "btn" })
|
||||
@Html.ActionLink("Delete", "Delete", "VehicleRecall", new { id = Model.VehicleId }, new { @class = "btn" })
|
||||
@Html.ActionLink("Vehicle Details", "Details", "Vehicle", new { id = Model.VehicleId }, new{@class="btn"})
|
||||
@Html.ActionLink("Add Service", "Create", "VehicleService", new { VehicleId = Model.VehicleId }, new{@class="btn"})
|
||||
</div>
|
||||
Reference in New Issue
Block a user