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

36 lines
797 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel;
namespace EHEC_Server.DatabaseAccess
{
public class ExamAccess
{
public bool CreateExam(Exam exam)
{
try
{
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
{
ctx.Exam.Add(exam);
ctx.SaveChanges();
}
return true;
}
catch (Exception)
{
return false;
}
}
public List<Exam> GetAllExams()
{
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
{
return ctx.Exam.ToList();
}
}
}
}