public ActionResult Create([Bind(Include = "FacultyID,FacultyName")] Faculty faculty) { if (ModelState.IsValid) { db.Faculties.Add(faculty); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(faculty)); }
public void AddRecord(ChooseViewModel viewModel, Record record, string SubjectName) { var groups = GetGroup(viewModel.Year, viewModel.Course, viewModel.Faculty); var group = groups.First(x => x.GroupName == viewModel.Group); var years = GetYear(viewModel.Course, viewModel.Faculty); var year = years.First(x => x.StartYear == viewModel.Year); record.GroupID = group.GroupID; record.SubjectID = GetSubjectID(year, SubjectName); db.Records.Add(record); db.SaveChanges(); }