@model EnVisage.Models.ViewModel
@using EnVisage.Code
@using EnVisage.Code.Extensions
@{
ViewBag.Title = Model.Id != Guid.Empty ? "Edit " + Model.Name : "Add View";
var availableCompanies = Utils.GetCompaniesTreeForCurrentUser();
var teams = Model.Teams != null ? Model.Teams.GetAsCommaSeparatedList() : "";
var watchers = Model.Watchers != null ? Model.Watchers.GetAsCommaSeparatedList() : "";
var companies = Model.Companies != null ? Model.Companies.GetAsCommaSeparatedList() : "";
}
@Html.LabelFor(model => model.Name, new { @class = "control-label" })
@Html.TextBoxFor(model => model.Name, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Name)
@Html.LabelFor(model => model.Teams, new { @class = "control-label" })
@Html.EditorFor(model => model.Teams, string.Empty, new { List = Utils.GetTeamsAvailableForUser(Guid.Parse(User.Identity.GetID())) })
@Html.ValidationMessageFor(model => model.Teams)
@Html.LabelFor(model => model.Companies, new { @class = "control-label" })
@Html.ValidationMessageFor(model => model.Companies)
@Html.LabelFor(model => model.Watchers, new { @class = "control-label" })
@Html.EditorFor(model => model.Watchers, string.Empty, new { List = Model.AvailableUsers.Select(x => new SelectListItem() { Value = x.Id.ToString(), Text = x.FirstName + " " + x.LastName }).ToList() })
@Html.ValidationMessageFor(model => model.Watchers)
@Html.ValidationSummary(false, "The View could not be saved due to the following errors:")
}