/// <summary>
 /// 根据学生编号获取学生信息
 /// get /api/student/id
 /// </summary>
 /// <param name="id">学生编号</param>
 /// <returns>学生信息</returns>
 public Student GetStudentById(int id)
 {
     try
     {
         IStudentBLL studentBll = BLLFactory.CreateStudentBLL();
         return(studentBll.GetStudentById(id));
     }
     catch (Exception ex)
     {
         ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
         log.Error("获取学生信息错误:" + ex);
         return(null);
     }
 }
 public bool UpdateStudent(Student student)
 {
     try
     {
         IStudentBLL studentBll = BLLFactory.CreateStudentBLL();
         return(studentBll.UpdateStudent(student));
     }
     catch (Exception ex)
     {
         ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
         log.Error("更新学生信息错误:" + ex);
         return(false);
     }
 }
 public IEnumerable <Student> Seach(string firstName, string lastName)
 {
     try
     {
         IStudentBLL studentBll = BLLFactory.CreateStudentBLL();
         return(studentBll.Seach(firstName, lastName));
     }
     catch (Exception ex)
     {
         ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
         log.Error("获取学生列表错误:" + ex);
         return(null);
     }
 }
        /// <summary>
        /// 添加学生信息
        /// post /api/student
        /// </summary>
        /// <param name="student">学生信息 </param>
        /// <returns></returns>
        public HttpResponseMessage Add(Student student)
        {
            try
            {
                IStudentBLL studentBll = BLLFactory.CreateStudentBLL();
                studentBll.AddStudent(student);
                var    response = Request.CreateResponse <Student>(HttpStatusCode.Created, student);
                string uri      = Url.Link("DefaultApi", new { id = student.Id });
                response.Headers.Location = new Uri(uri);

                return(response);
            }
            catch (Exception ex)
            {
                ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
                log.Error("添加学生错误:" + ex);
                return(null);
            }
        }
Exemplo n.º 5
0
 public AdminController(IClassBLL classBll, ISurveyRepository surveyRepository, IStudentBLL studentBLL)
 {
     _classBll   = classBll;
     _surveyRepo = surveyRepository;
     _studentBLL = studentBLL;
 }
Exemplo n.º 6
0
 public StudentController(IStudentBLL studentBll)
 {
     _studentBll = studentBll;
 }
Exemplo n.º 7
0
 public HomeController(ILogger <HomeController> logger, IStudentBLL istudentBLL, IConfiguration iconfiguration)
 {
     _logger             = logger;
     this.istudentBLL    = istudentBLL;
     this.iconfiguration = iconfiguration;
 }
Exemplo n.º 8
0
 public StudentUoW(IStudentBLL studentBLL)
 {
     this.studentBLL = studentBLL;
 }
Exemplo n.º 9
0
 public StudentController(ILogger <StudentController> logger, IStudentBLL istudentBLL)
 {
     _logger          = logger;
     this.istudentBLL = istudentBLL;
 }
Exemplo n.º 10
0
 public StudentController(IConfiguration configuration, ILogger <StudentController> logger, IStudentBLL istudentBLL)
 {
     this.configuration = configuration;
     _logger            = logger;
     this.istudentBLL   = istudentBLL;
 }
Exemplo n.º 11
0
 public HomeController(ILogger <HomeController> logger, IMessageDAL imessageService, IStudentBLL studentBLL)
 {
     _logger          = logger;
     _imessageService = imessageService;
     this.studentBLL  = studentBLL;
 }
Exemplo n.º 12
0
 public HomeController(IStudentBLL bLL, IMenuBLL menuBLL)
 {
     StuBLL  = bLL;
     MenuBLL = menuBLL;
 }
Exemplo n.º 13
0
 public AccountController(IStudentBLL bLL)
 {
     StuBLL = bLL;
 }