public ClaimsIdentity CreateStudentIdentity(StudentSet user) { var identity = new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, user.Name + " " + user.Surname), new Claim(ClaimTypes.Sid, user.Id.ToString()), new Claim(ClaimTypes.Role, "Student"), new Claim(ClaimTypes.Email, user.Email) }, "ApplicationCookie"); return identity; }
public ActionResult Edit(StudentSet student) { if (student.Password == null) { ModelState.AddModelError("Password", "Password is required"); return View(student); } _applicationService.EditStudent(student); var studentListViewModel = _applicationService.GetStudentListViewModelByGroupId(student.Group_Id.ToString()); return View("StudentList", studentListViewModel); }
public ActionResult Add(StudentSet student) { var studentExist = _applicationService.GetStudentByLogin(student.Login); if (studentExist == null) { if (student.Password == null || student.Login == null) { ModelState.AddModelError("Login", "Login and password are required"); return View(student); } _applicationService.AddStudent(student); var studentListViewModel = _applicationService.GetStudentListViewModelByGroupId(student.Group_Id.ToString()); return View("StudentList", studentListViewModel); } else { ModelState.AddModelError("Login", "This login exists"); return View(student); } }
public void AddStudent(StudentSet student) { _databaseService.AddStudent(student); }
public void EditStudent(StudentSet student) { _databaseService.EditStudent(student); }
public ActionResult Add(string groupId) { var id = Int32.Parse(groupId); var student = new StudentSet(){Group_Id = id}; return View(student); }
public void EditStudent(StudentSet student) { context.StudentSet.AddOrUpdate(student); context.SaveChanges(); }
public void AddStudent(StudentSet student) { context.StudentSet.Add(student); context.SaveChanges(); }
public void RemoveStudent(StudentSet student) { context.StudentSet.Remove(student); context.SaveChanges(); }