예제 #1
0
        public async Task <IActionResult> GetAbsent(IEnumerable <Absent> absents)
        {
            var isInsert = false;

            if (!context.Absent.Any(a => a.DateAbsent.Date == DateTime.Today && a.StudentId == absents.First().StudentId))
            {
                await context.AddRangeAsync(absents);

                SaveStudentAbsent(absents);
                await context.SaveChangesAsync();

                isInsert = true;
            }
            return(Ok(new { isInsert = isInsert }));
        }