oop_II-6/EHEC_Server/EHEC_Server/DatabaseAccess/ExamAccess.cs

36 lines
804 B
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
2018-06-24 17:36:08 +02:00
using System.ServiceModel;
2018-06-24 17:36:08 +02:00
namespace EHEC_Server.DatabaseAccess
{
public class ExamAccess
{
public Exam CreateExam(Exam exam)
{
try
{
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
{
ctx.Exams.Add(exam);
ctx.SaveChanges();
}
return exam;
}
catch (Exception)
{
return new Exam();
}
}
2018-06-24 17:36:08 +02:00
public List<Exam> GetAllExams()
{
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
{
return ctx.Exams.ToList();
2018-06-24 17:36:08 +02:00
}
}
}
}