Skip to content

Commit 35055ef

Browse files
authored
Add email field for student in the complete UI (#27)
2 parents 30b77b7 + f79eb67 commit 35055ef

14 files changed

Lines changed: 4306 additions & 175 deletions

MarkMe.Core/DTOs/StudentDTO.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class StudentDTO
1616
public string RegistrationNo { get; set; }
1717
public string Session { get; set; }
1818
public string Section { get; set; }
19+
public string Email { get; set; }
1920
}
2021
public class CreateStudentDTO
2122
{
@@ -26,5 +27,6 @@ public class CreateStudentDTO
2627
public string RegistrationNo { get; set; }
2728
public string Session { get; set; }
2829
public string Section { get; set; }
30+
public string Email { get; set; }
2931
}
3032
}

MarkMe.Core/Repositories/StudentRepository.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ public class StudentRepository(IDatabase _database) : IStudentRepository
99

1010
public async Task<StudentDTO> AddStudentAsync(StudentDTO obj)
1111
{
12-
var sql = "INSERT INTO Students (CollegeRollNo, UniversityRollNo, RegistrationNo, FirstName, LastName, Session, Section, IsDeleted) " +
13-
"VALUES (@CollegeRollNo, @UniversityRollNo, @RegistrationNo, @FirstName, @LastName, @Session, @Section, 0); " +
12+
var sql = "INSERT INTO Students (CollegeRollNo, UniversityRollNo, RegistrationNo, FirstName, LastName, Session, Section, IsDeleted, Email) " +
13+
"VALUES (@CollegeRollNo, @UniversityRollNo, @RegistrationNo, @FirstName, @LastName, @Session, @Section, 0, @Email); " +
1414
"SELECT SCOPE_IDENTITY()";
1515

1616
obj.StudentId = await _database.QuerySingleAsync<int>(sql, parameters: obj);
@@ -71,7 +71,7 @@ FROM ClassRepresentatives
7171
UPDATE Students
7272
SET
7373
CollegeRollNo = @CollegeRollNo, UniversityRollNo = @UniversityRollNo, RegistrationNo = @RegistrationNo,
74-
FirstName = @FirstName, LastName = @LastName, Session = @Session, Section = @Section
74+
FirstName = @FirstName, LastName = @LastName, Session = @Session, Section = @Section, Email = @Email
7575
WHERE StudentId = @StudentId;
7676
7777
SELECT * FROM Students WHERE StudentId = @StudentId

MarkMe.Core/Services/StudentService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ public async Task<StudentDTO> AddAsync(CreateStudentDTO obj)
1818
FirstName = obj.FirstName,
1919
LastName = obj.LastName,
2020
Session = obj.Session,
21-
Section = obj.Section
21+
Section = obj.Section,
22+
Email = obj.Email
2223
};
2324
var stcd = await _studRepo.AddStudentAsync(student);
2425
return stcd;

MarkMe.Database/AppDbContext.cs

Lines changed: 96 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
5454
UniversityRollNo="070982",
5555
Section="G1",
5656
Session="20212025",
57+
Email = "mnaeem@gmail.com",
5758
IsDeleted = false
5859
},
5960
new Student() {
@@ -65,6 +66,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
6566
UniversityRollNo="070943",
6667
Section="G1",
6768
Session="20212025",
69+
Email = "asattar@gmail.com",
6870
IsDeleted = false
6971
},
7072
new Student() {
@@ -76,6 +78,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
7678
UniversityRollNo="070944",
7779
Section="G1",
7880
Session="20212025",
81+
Email = "asenior@gmail.com",
7982
IsDeleted = false
8083
},
8184
new Student() {
@@ -87,6 +90,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
8790
UniversityRollNo="070945",
8891
Section="G1",
8992
Session="20212025",
93+
Email = "aali@gmail.com",
9094
IsDeleted = false
9195
},
9296
new Student() {
@@ -98,6 +102,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
98102
UniversityRollNo="070946",
99103
Section="G1",
100104
Session="20212025",
105+
Email = "asad@gmail.com",
101106
IsDeleted = false
102107
},
103108
new Student() {
@@ -109,6 +114,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
109114
UniversityRollNo="070947",
110115
Section="G1",
111116
Session="20212025",
117+
Email = "adildar@gmail.com",
112118
IsDeleted = false
113119
},
114120
new Student() {
@@ -120,6 +126,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
120126
UniversityRollNo="070948",
121127
Section="G1",
122128
Session="20212025",
129+
Email = "masgher@gmail.com",
123130
IsDeleted = false
124131
},
125132
new Student() {
@@ -131,6 +138,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
131138
UniversityRollNo="070949",
132139
Section="G1",
133140
Session="20212025",
141+
Email = "wmaqsood@gmail.com",
134142
IsDeleted = false
135143
},
136144
new Student() {
@@ -142,6 +150,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
142150
UniversityRollNo="070950",
143151
Section="G1",
144152
Session="20212025",
153+
Email = "maqdas@gmail.com",
145154
IsDeleted = false
146155
},
147156
new Student() {
@@ -153,6 +162,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
153162
UniversityRollNo="070951",
154163
Section="G1",
155164
Session="20212025",
165+
Email = "naslam@gmail.com",
156166
IsDeleted = false
157167
},
158168
new Student() {
@@ -164,6 +174,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
164174
UniversityRollNo="070952",
165175
Section="G1",
166176
Session="20212025",
177+
Email = "matif@gmail.com",
167178
IsDeleted = false
168179
},
169180
new Student() {
@@ -175,6 +186,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
175186
UniversityRollNo="070953",
176187
Section="G1",
177188
Session="20212025",
189+
Email = "aali@gmail.com",
178190
IsDeleted = false
179191
},
180192
new Student() {
@@ -186,6 +198,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
186198
UniversityRollNo="070954",
187199
Section="G1",
188200
Session="20212025",
201+
Email = "aabbas@gmail.com",
189202
IsDeleted = false
190203
},
191204
new Student() {
@@ -197,6 +210,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
197210
UniversityRollNo="070955",
198211
Section="G1",
199212
Session="20212025",
213+
Email = "rshahmeer@gmail.com",
200214
IsDeleted = false
201215
},
202216
new Student() {
@@ -208,6 +222,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
208222
UniversityRollNo="070956",
209223
Section="G1",
210224
Session="20212025",
225+
Email = "ashamraiz@gmail.com",
211226
IsDeleted = false
212227
},
213228
});
@@ -305,87 +320,87 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
305320
}
306321
});
307322

308-
// Class Representatives
309-
modelBuilder.Entity<ClassRepresentative>().HasData(new[]
310-
{
311-
new ClassRepresentative
312-
{
313-
StudentId = 1,
314-
CourseId = 1,
315-
NominatedBy = 1,
316-
IsDeleted = 0
317-
},
318-
new ClassRepresentative
319-
{
320-
StudentId = 2,
321-
CourseId = 2,
322-
NominatedBy = 1,
323-
IsDeleted = 0
324-
},
325-
new ClassRepresentative
326-
{
327-
StudentId = 2,
328-
CourseId = 1,
329-
NominatedBy = 1,
330-
IsDeleted = 0
331-
},
332-
new ClassRepresentative
333-
{
334-
StudentId = 2,
335-
CourseId = 3,
336-
NominatedBy = 1,
337-
IsDeleted = 0
338-
},
339-
new ClassRepresentative
340-
{
341-
StudentId = 2,
342-
CourseId = 4,
343-
NominatedBy = 1,
344-
IsDeleted = 0
345-
},
346-
new ClassRepresentative
347-
{
348-
StudentId = 2,
349-
CourseId = 5,
350-
NominatedBy = 1,
351-
IsDeleted = 0
352-
},
353-
new ClassRepresentative
354-
{
355-
StudentId = 3,
356-
CourseId = 3,
357-
NominatedBy = 1,
358-
IsDeleted = 0
359-
},
360-
new ClassRepresentative
361-
{
362-
StudentId = 4,
363-
CourseId = 4,
364-
NominatedBy = 1,
365-
IsDeleted = 0
366-
},
367-
new ClassRepresentative
368-
{
369-
StudentId = 5,
370-
CourseId = 5,
371-
NominatedBy = 1,
372-
IsDeleted = 0
373-
},
374-
new ClassRepresentative
375-
{
376-
StudentId = 6,
377-
CourseId = 1,
378-
NominatedBy = 1,
379-
IsDeleted = 0
380-
},
381-
new ClassRepresentative
382-
{
383-
StudentId = 7,
384-
CourseId = 2,
385-
NominatedBy = 1,
386-
IsDeleted = 0,
387-
}
388-
});
323+
//// Class Representatives
324+
//modelBuilder.Entity<ClassRepresentative>().HasData(new[]
325+
//{
326+
// new ClassRepresentative
327+
// {
328+
// StudentId = 1,
329+
// CourseId = 1,
330+
// NominatedBy = 1,
331+
// IsDeleted = 0
332+
// },
333+
// new ClassRepresentative
334+
// {
335+
// StudentId = 2,
336+
// CourseId = 2,
337+
// NominatedBy = 1,
338+
// IsDeleted = 0
339+
// },
340+
// new ClassRepresentative
341+
// {
342+
// StudentId = 2,
343+
// CourseId = 1,
344+
// NominatedBy = 1,
345+
// IsDeleted = 0
346+
// },
347+
// new ClassRepresentative
348+
// {
349+
// StudentId = 2,
350+
// CourseId = 3,
351+
// NominatedBy = 1,
352+
// IsDeleted = 0
353+
// },
354+
// new ClassRepresentative
355+
// {
356+
// StudentId = 2,
357+
// CourseId = 4,
358+
// NominatedBy = 1,
359+
// IsDeleted = 0
360+
// },
361+
// new ClassRepresentative
362+
// {
363+
// StudentId = 2,
364+
// CourseId = 5,
365+
// NominatedBy = 1,
366+
// IsDeleted = 0
367+
// },
368+
// new ClassRepresentative
369+
// {
370+
// StudentId = 3,
371+
// CourseId = 3,
372+
// NominatedBy = 1,
373+
// IsDeleted = 0
374+
// },
375+
// new ClassRepresentative
376+
// {
377+
// StudentId = 4,
378+
// CourseId = 4,
379+
// NominatedBy = 1,
380+
// IsDeleted = 0
381+
// },
382+
// new ClassRepresentative
383+
// {
384+
// StudentId = 5,
385+
// CourseId = 5,
386+
// NominatedBy = 1,
387+
// IsDeleted = 0
388+
// },
389+
// new ClassRepresentative
390+
// {
391+
// StudentId = 6,
392+
// CourseId = 1,
393+
// NominatedBy = 1,
394+
// IsDeleted = 0
395+
// },
396+
// new ClassRepresentative
397+
// {
398+
// StudentId = 7,
399+
// CourseId = 2,
400+
// NominatedBy = 1,
401+
// IsDeleted = 0,
402+
// }
403+
//});
389404

390405
// Activities
391406
modelBuilder.Entity<Activity>().HasData(new[]

MarkMe.Database/Entities/Student.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public class Student
2222
[StringLength(50)]
2323
public string LastName { get; set; } = string.Empty;
2424

25+
[EmailAddress]
26+
public string Email { get; set; } = string.Empty;
27+
2528
[StringLength(9, ErrorMessage = "Session cannot be longer than 9 characters.")]
2629
public string Session { get; set; } = string.Empty;
2730

0 commit comments

Comments
 (0)