Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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());
        }