<% if (selectedFac !=null && selectedFac.IsFacilityAdmin && Model.User.Id != ViewUtility.GetCurrentUser().User.Id)
{ %>
<%: Html.ActionLink("Delete", "DeleteUserRole", "User", new { id = Model.User.Id, facilityId = selectedFac.Facility.Id }, new { @class = "deleteButton", Title = "Are you sure you want to delete this user from the facility?" })%>
<%} %>
<%if (Request.QueryString["facilityId"]!=null) //check if facilityId is present. if it is, we are in the context of a facility and need to load facility user list.
{%>
<%: Html.ActionLink("Cancel", "FacilityUser", "Facility", new { id = selectedFac.Facility.Id }, new { @class = "cancelButton" })%>
<%}
else
{ %>
<%: Html.ActionLink("Cancel", "List", "User", new { type = Model.User.Type.ToString().ToLower() }, new { @class = "cancelButton" })%>
<%} %>