removed migration ,altered Guid to int

This commit is contained in:
2022-02-22 17:14:10 +08:00
parent 166821a52e
commit e0115e0e07
48 changed files with 559 additions and 505 deletions
+10 -10
View File
@@ -33,7 +33,7 @@ namespace _2021_backend.Controllers
{
if(aDto.Timelist != null)if (aDto.Timelist.Any(it => it.Day.Day == tm.Day.Day && it.BeginTime.TimeOfDay == tm.BeginTime.TimeOfDay))
{
sub.Timelist.Add(tm.Guid);
sub.Timelist.Add(tm.Id);
}
}
var q = Context.Students.Where(stu => (stu.Name == aDto.Name || stu.Stuid == aDto.Stuid));
@@ -49,7 +49,7 @@ namespace _2021_backend.Controllers
stu = q.FirstOrDefault();
stu.Update(sub);
}
sub.Host = stu.Guid;
sub.Host = stu.Id;
Context.Submissions.Add(sub);
Context.SaveChanges();
await TencentSMS.Send(Context, SMSType.Signed, stu, _2021_backend.Models.User.Bot.stuID);
@@ -96,7 +96,7 @@ namespace _2021_backend.Controllers
Student stu = Context.Students.FirstOrDefault(r => r.Stuid == stuid);
if (stu == null)
{
return StatusCode(400, ApiResponse.Error("INVALID_STUDENT_GUID"));
return StatusCode(400, ApiResponse.Error("INVALID_STUDENT_int"));
}
SessionDto time;
try
@@ -108,8 +108,8 @@ namespace _2021_backend.Controllers
Console.WriteLine(ex);
return StatusCode(400, ApiResponse.Error("MALFORMED_DATA"));
};
//get the selected session guids;
Guid targetSession = Guid.Empty;
//get the selected session ints;
int targetSession = 0;
var sessions = Context.Sessions.ToList();
var s = sessions.Find((Session s) =>
{
@@ -120,15 +120,15 @@ namespace _2021_backend.Controllers
if (Context.Sessions.Find(stu.InterviewTime) != null)
{
var olds = Context.Sessions.Find(stu.InterviewTime);
olds.Students.Remove(stu.Guid);
olds.Students.Remove(stu.Id);
Context.SaveChanges();
overwritten = true;
}
targetSession = s.Guid;
s.Students.Add(stu.Guid);
stu.Timelist = new List<Guid> { targetSession};
targetSession = s.Id;
s.Students.Add(stu.Id);
stu.Timelist = new List<int> { targetSession};
stu.Status = status.已选时间;
stu.InterviewTime = s.Guid;
stu.InterviewTime = s.Id;
await TencentSMS.Send(Context, SMSType.TimeSet, stu, "smsbot");
Context.SaveChanges();
if (overwritten) return Ok(ApiResponse.Success("overwritten"));