@using System.Web.Script.Serialization
@using Microsoft.Ajax.Utilities
@using RSystem.Models
@model RSystem.Areas.Admin.Models.SpecializationCreateViewModel
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
@Html.HiddenFor(model => model.Specialization.SpecializationId);
@Html.LabelFor(model => model.Specialization.FacultyId, "Wydział", htmlAttributes: new { @class = "label-form required" })
@Html.DropDownListFor(model=>model.Specialization.FacultyId, Model.Faculties, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Specialization.FacultyId, "", new { @class = "text-danger" })
@Html.LabelFor(m => m.Specialization.Name, new {@class = "label-form required"})
@Html.EditorFor(m => m.Specialization.Name, new {htmlAttributes = new {@class = "form-control no-radius",placeholder="Informatyka"}})
@Html.ValidationMessageFor(model => model.Specialization.Name, "", new {@class = "text-danger"})
@Html.LabelFor(model => model.Specialization.Deadline, htmlAttributes: new {@class = "label-form required"})
@Html.EditorFor(model => model.Specialization.Deadline, new {htmlAttributes = new {@class = "form-control"}})
@Html.ValidationMessageFor(model => model.Specialization.Deadline, "", new {@class = "text-danger"})
@Html.LabelFor(model => model.Specialization.LimitOfPlaces, htmlAttributes: new { @class = "label-form required" })
@Html.EditorFor(model => model.Specialization.LimitOfPlaces, new { htmlAttributes = new { @class = "form-control no-radius",placeholder="150"} })
@Html.LabelFor(model => model.Specialization.Description, htmlAttributes: new {@class = "label-form required"})
@Html.EditorFor(model => model.Specialization.Description, new {htmlAttributes = new {@class = "form-control no-radius", placeholder = "3,5 roczne studnia stacjonarne"}})
@if (Model.PointsMultipilers != null)
{
for (int i = 0; i < Multipilers(MaturaType.Nowa).Count(); i++)
{
@Multipilers(MaturaType.Nowa)[i].Multipiler
@Multipilers(MaturaType.Nowa)[i].MaturaSubject.Name
}
}
@if (Model.PointsMultipilers != null)
{
for (int i = 0; i < Multipilers(MaturaType.Stara).Count(); i++)
{
@Multipilers(MaturaType.Stara)[i].Multipiler
@Multipilers(MaturaType.Stara)[i].MaturaSubject.Name
}
}
@if (Model.PointsMultipilers != null)
{
for (int i = 0; i < Multipilers(MaturaType.Międzynarodowa).Count(); i++)
{
@Multipilers(MaturaType.Międzynarodowa)[i].Multipiler
@Multipilers(MaturaType.Międzynarodowa)[i].MaturaSubject.Name
}
}
@Html.ActionLink("Anuluj", "Index", "Home", new { @class = "form-cancel form-btn" })
}
@section Scripts{
}
@section DedicatedStyles
{
}
@functions
{
string DropDownListOptions(MaturaType maturaType)
{
var serializer = new JavaScriptSerializer();
var availableSubjects = Model.MaturaSubjects.Where(mt => mt.MaturaType == maturaType);
var list=new List();
foreach (var subject in availableSubjects)
{
list.Add(new
{
id=subject.MaturaSubjectId,
name=subject.Name
});
}
return serializer.Serialize(list);
}
List Multipilers(MaturaType maturaType)
{
return Model.PointsMultipilers.Where(m => m.MaturaSubject.MaturaType == maturaType).ToList();
}
SelectList MaturaTypeSL(MaturaType type)
{
return new SelectList(Model.MaturaSubjects.Where(t=>t.MaturaType==type), "MaturaSubjectId","Name");
}
}