-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentService.cs
More file actions
54 lines (48 loc) · 1.63 KB
/
StudentService.cs
File metadata and controls
54 lines (48 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using MarkMe.Core.DTOs;
using MarkMe.Core.Repositories.Interface;
using MarkMe.Core.Services.Interface;
using MarkMe.Database.Entities;
using MarkMe.Database.Interface;
namespace MarkMe.Core.Services
{
public class StudentService(IStudentRepository _studRepo) : IStudentService
{
public async Task<StudentDTO> AddAsync(CreateStudentDTO obj)
{
var student = new StudentDTO
{
CollegeRollNo = obj.CollegeRollNo,
UniversityRollNo = obj.UniversityRollNo,
RegistrationNo = obj.RegistrationNo,
FirstName = obj.FirstName,
LastName = obj.LastName,
Session = obj.Session,
Section = obj.Section,
Email = obj.Email
};
var stcd = await _studRepo.AddStudentAsync(student);
return stcd;
}
public async Task<bool> DeleteAsync(int id)
{
return await _studRepo.DeleteStudentAsync(id);
}
public async Task<StudentDTO?> GetAsync(int id)
{
return await _studRepo.GetStudentAsync(id);
}
public async Task<IEnumerable<StudentDTO>> GetAllAsync()
{
return await _studRepo.GetAllStudentsAsync();
}
public Task<IEnumerable<StudentDTO>> GetCRNomineesAsync()
{
return _studRepo.GetCRNomineesAsync();
}
public async Task<StudentDTO> UpdateAsync(StudentDTO updatedObj)
{
var updated = await _studRepo.UpdateStudentAsync(updatedObj.StudentId, updatedObj);
return updated;
}
}
}