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

36 lines
791 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
{
public partial class Exam
{
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();
}
}
public List<Exam> GetAllExams()
2018-06-24 17:36:08 +02:00
{
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
{
return ctx.Exams.ToList();
2018-06-24 17:36:08 +02:00
}
}
}
}