diff --git a/Service_Server/Service_Server/DB/Doctor_DB.cs b/Service_Server/Service_Server/DB/Doctor_DB.cs index a5e6fb6..2bd78c6 100644 --- a/Service_Server/Service_Server/DB/Doctor_DB.cs +++ b/Service_Server/Service_Server/DB/Doctor_DB.cs @@ -4,11 +4,12 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Web; namespace Service_Server.DB { - class Doctor_DB + public class Doctor_DB { public List GetAllDoctors() { diff --git a/Service_Server/Service_Server/DB/Origin_DB.cs b/Service_Server/Service_Server/DB/Origin_DB.cs index 4ec9624..5bdbb4c 100644 --- a/Service_Server/Service_Server/DB/Origin_DB.cs +++ b/Service_Server/Service_Server/DB/Origin_DB.cs @@ -4,10 +4,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Web; namespace Service_Server.DB { - class Origin_DB + public class Origin_DB { public List GetAllOrigins() { diff --git a/Service_Server/Service_Server/DB/PStatus_DB.cs b/Service_Server/Service_Server/DB/PStatus_DB.cs index a3bccec..b49570d 100644 --- a/Service_Server/Service_Server/DB/PStatus_DB.cs +++ b/Service_Server/Service_Server/DB/PStatus_DB.cs @@ -4,10 +4,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Web; namespace Service_Server.DB { - class PStatus_DB + public class PStatus_DB { public List GetAllPstatuses() { diff --git a/Service_Server/Service_Server/DB/Person_DB.cs b/Service_Server/Service_Server/DB/Person_DB.cs index 83f308a..816e6b4 100644 --- a/Service_Server/Service_Server/DB/Person_DB.cs +++ b/Service_Server/Service_Server/DB/Person_DB.cs @@ -4,10 +4,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Web; namespace Service_Server.DB { - class Person_DB + public class Person_DB { public List GetAllPersons() { diff --git a/Service_Server/Service_Server/DB/Result_DB.cs b/Service_Server/Service_Server/DB/Result_DB.cs new file mode 100644 index 0000000..00303a2 --- /dev/null +++ b/Service_Server/Service_Server/DB/Result_DB.cs @@ -0,0 +1,74 @@ +using Service_Server.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web; + + +namespace Service_Server.DB +{ + public class Result_DB + { + public List GetAllResults() + { + using (DATABASE ctx = new DATABASE()) + { + return ctx.Results.ToList(); + } + } + public bool CreateResult(Result result) + { + try + { + using (DATABASE ctx = new DATABASE()) + { + ctx.Results.Add(result); + ctx.SaveChanges(); + } + return true; + } + catch (Exception) + { + return false; + } + } + + public bool UpdateResult(Result result) + { + try + { + using (DATABASE ctx = new DATABASE()) + { + ctx.Results.Attach(result); + ctx.Entry(result).State = System.Data.Entity.EntityState.Modified; + ctx.SaveChanges(); + } + return true; + } + catch (Exception) + { + return false; + } + + } + public bool DeleteResult(Result result) + { + try + { + using (DATABASE ctx = new DATABASE()) + { + ctx.Results.Attach(result); + ctx.Results.Remove(result); + ctx.SaveChanges(); + } + return true; + } + catch (Exception) + { + return false; + } + } + } +}