コード例 #1
0
 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;
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 public void AddStudent(StudentSet student)
 {
     _databaseService.AddStudent(student);
 }
コード例 #5
0
 public void EditStudent(StudentSet student)
 {
     _databaseService.EditStudent(student);
 }
コード例 #6
0
 public ActionResult Add(string groupId)
 {
     var id = Int32.Parse(groupId);
     var student = new StudentSet(){Group_Id = id};
     return View(student);
 }
コード例 #7
0
 public void EditStudent(StudentSet student)
 {
     context.StudentSet.AddOrUpdate(student);
     context.SaveChanges();
 }
コード例 #8
0
 public void AddStudent(StudentSet student)
 {
     context.StudentSet.Add(student);
     context.SaveChanges();
 }
コード例 #9
0
 public void RemoveStudent(StudentSet student)
 {
     context.StudentSet.Remove(student);
     context.SaveChanges();
 }