public async Task <STUDENT> DeleteStudent(int studentID) { STUDENT dbEntry = new STUDENT(); dbEntry = _context.STUDENT.Find(studentID); if (dbEntry != null) { _context.STUDENT.Remove(dbEntry); } await _context.SaveChangesAsync(); return(dbEntry); }
public STUDENT GetStudent(int studentID) { STUDENT dbEntry = new STUDENT(); dbEntry = _context .STUDENT .Include("POLOZENI_ISPITI") .Where(s => s .StudentID == studentID && s .POLOZENI_ISPITI .All(p => p .StudentID == studentID)) .FirstOrDefault(); return(dbEntry); }
public async Task <int> SaveStudent(STUDENT student) { if (student.StudentID == 0) { _context.STUDENT.Add(student); } else { STUDENT dbEntry = new STUDENT(); dbEntry = _context.STUDENT.Find(student.StudentID); if (dbEntry != null) { dbEntry.ImePrezime = student.ImePrezime; } } return(await _context.SaveChangesAsync()); }