示例#1
0
        public async Task <IActionResult> PutExam(Guid id, Exam exam)
        {
            if (id != exam.Id)
            {
                return(BadRequest());
            }

            _context.Entry(exam).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ExamExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutStudentSubject(Guid id, StudentSubject studentSubject)
        {
            if (id != studentSubject.Id)
            {
                return(BadRequest());
            }

            _context.Entry(studentSubject).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StudentSubjectExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <PaymentHistory> AddPayment(PaymentHistory payment)
        {
            _db.paymentHistories.Add(payment);
            await _db.SaveChangesAsync();

            return(payment);
        }
示例#4
0
        public async Task <ActionResult <Exam> > DeleteExam(Guid id)
        {
            var exam = await _context.Exams.FindAsync(id);

            if (exam == null)
            {
                return(NotFound());
            }

            _context.Exams.Remove(exam);
            await _context.SaveChangesAsync();

            return(exam);
        }
示例#5
0
        public async Task <ActionResult <Student> > DeleteStudent(Guid id)
        {
            var student = await _context.StudentDb.FindAsync(id);

            if (student == null)
            {
                return(NotFound());
            }

            _context.StudentDb.Remove(student);
            await _context.SaveChangesAsync();

            return(student);
        }
示例#6
0
        public async Task <ActionResult <Subject> > DeleteSubject(Guid id)
        {
            var subject = await _context.Subjects.FindAsync(id);

            if (subject == null)
            {
                return(NotFound());
            }

            _context.Subjects.Remove(subject);
            await _context.SaveChangesAsync();

            return(subject);
        }