public ActionResult AddStudentToGroup(AddStudentToGroup model) { //complete operation GroupService service = new GroupService(); service.AddUserToGroup(db, model.StudentId, model.GroupId, model.Date); return RedirectToAction("Index", "Group"); }
public ActionResult AddStudentToGroup(int id) { Student student = db.Students.Find(id); if (student == null) { return HttpNotFound(); } ViewBag.GroupId = new SelectList(db.Groups, "Id", "Name"); var model = new AddStudentToGroup() { StudentId = id, Date = DateTime.Now }; return View(model); }