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

36 lines
826 B
C#
Raw Normal View History

2018-06-22 16:29:27 +02:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel;
2018-06-24 17:36:08 +02:00
2018-06-22 16:29:27 +02:00
namespace EHEC_Server.DatabaseAccess
{
public class DoctorAccess
{
public Doctor CreateDoctor(Doctor doctor)
2018-06-22 16:29:27 +02:00
{
try
{
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
{
ctx.Doctor.Add(doctor);
ctx.SaveChanges();
}
return doctor;
2018-06-22 16:29:27 +02:00
}
catch (Exception)
{
return new Doctor();
2018-06-22 16:29:27 +02:00
}
}
public List<Doctor> GetAllDoctors()
{
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
{
return ctx.Doctor.ToList();
}
}
}
}