Example #1
0
 public IActionResult Edit(StudentsDetailsViewModel student)
 {
     repository.Create(new Models.Student()
     {
         First     = student.First,
         Middle    = student.Middle,
         Last      = student.Last,
         BirthDate = student.BirthDate,
         Sex       = student.Sex,
         RankId    = student.Rank.Id,
     });
     return(RedirectToAction("Index", "Students"));
 }
        public IActionResult CreateStudent(StudentEntity student)
        {
            Random randomGenerator = new Random();
            int    indexNumber     = randomGenerator.Next(10000, 99999);

            student.IndexNumber = indexNumber;

            StudentEntity newStudent = _studentsRepo.Create(student);

            _studentsRepo.SaveChanges();

            return(CreatedAtRoute("GetById", new { newStudent.Id }, newStudent));
        }
Example #3
0
 public IActionResult Create(CreateStudentsViewsModels model)
 {
     if (ModelState.IsValid)
     {
         var emp = studentsRepository.Gets();
         var stu = new Students()
         {
             NgaySinh = model.NgaySinh,
             Email    = model.Email,
             GioiTinh = model.GioiTinh,
             HoTen    = model.HoTen,
             LopHocId = model.LopHocId
         };
         var stud = studentsRepository.Create(stu);
         if (stu != null)
         {
             return(RedirectToAction("Index", new { id = stu.ID }));
         }
     }
     return(View(model));
 }
 public int Create(Student student)
 {
     return(_studentsRepository.Create(student));
 }
Example #5
0
 public async Task <Student> CreateStudent(Student student)
 {
     return(await _studentsRepository.Create(student));
 }
Example #6
0
 public Student CreateStudent(Student entity)
 {
     return(_repository.Create(entity));
 }