Advertisement
Guest User

Untitled

a guest
Jan 17th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. using isima.DAL;
  2. using Isima.DTO;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace Isima.Business
  10. {
  11.     public class StudentService
  12.     {
  13.  
  14.         public IList<StudentDto> GetAllStudent()
  15.         {
  16.             using(StudentRepository _studentRepo = new StudentRepository())
  17.             {
  18.                 return _studentRepo.GetAllStudent();
  19.             }
  20.         }
  21.  
  22.         public StudentDto AddStudent(StudentDto student)
  23.         {
  24.             if(student !=null)
  25.             {
  26.                 using (StudentRepository _studentRepo = new StudentRepository())
  27.                 {
  28.                     return _studentRepo.AddStudent(student);
  29.                 }
  30.             }
  31.            else
  32.             {
  33.                 throw new ArgumentNullException(nameof(student), "Student can't be null");
  34.             }
  35.         }
  36.  
  37.  
  38.        
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement