You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
1.6 KiB
C#
77 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using xUnitStudy.Dal;
|
|
using xUnitStudy.IBll;
|
|
using xUnitStudy.IDal;
|
|
using xUnitStudy.Model;
|
|
|
|
namespace xUnitStudy.Bll
|
|
{
|
|
public class StudentBll : IStudentBll
|
|
{
|
|
public IStudentDal dal = new StudentDal();
|
|
|
|
public StudentBll()
|
|
{
|
|
dal = new StudentDal();
|
|
students = dal.GetAll();
|
|
}
|
|
|
|
public StudentBll(IStudentDal studentDal):this()
|
|
{
|
|
this.dal = studentDal;
|
|
}
|
|
|
|
private List<Student> students;
|
|
|
|
public List<Student> Students
|
|
{
|
|
get { return students; }
|
|
set { value = students; }
|
|
}
|
|
|
|
public (bool result, Student student) AddStudent(Student student)
|
|
{
|
|
return dal.AddStudent(student);
|
|
}
|
|
|
|
public List<Student> GetAll()
|
|
{
|
|
return dal.GetAll();
|
|
}
|
|
|
|
public Student GetStudentById(int studentId)
|
|
{
|
|
return dal.GetStudentById(studentId);
|
|
}
|
|
|
|
public (bool result, Student student) UpdateStudent(Student student)
|
|
{
|
|
return dal.UpdateStudent(student);
|
|
}
|
|
|
|
public bool DeleteStudent(int studentId)
|
|
{
|
|
return dal.DeleteStudent(studentId);
|
|
}
|
|
|
|
public int GetTuition(int studentId)
|
|
{
|
|
var student = dal.GetStudentById(studentId);
|
|
|
|
if (student == null)
|
|
{
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
return student.Age + studentId;
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|