added db files for the migration
This commit is contained in:
parent
d977fc0433
commit
c794b29d30
|
@ -4,11 +4,12 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
|
|
||||||
namespace Service_Server.DB
|
namespace Service_Server.DB
|
||||||
{
|
{
|
||||||
class Doctor_DB
|
public class Doctor_DB
|
||||||
{
|
{
|
||||||
public List<Doctor> GetAllDoctors()
|
public List<Doctor> GetAllDoctors()
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,10 +4,11 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
namespace Service_Server.DB
|
namespace Service_Server.DB
|
||||||
{
|
{
|
||||||
class Origin_DB
|
public class Origin_DB
|
||||||
{
|
{
|
||||||
public List<Origin> GetAllOrigins()
|
public List<Origin> GetAllOrigins()
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,10 +4,11 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
namespace Service_Server.DB
|
namespace Service_Server.DB
|
||||||
{
|
{
|
||||||
class PStatus_DB
|
public class PStatus_DB
|
||||||
{
|
{
|
||||||
public List<PStatus> GetAllPstatuses()
|
public List<PStatus> GetAllPstatuses()
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,10 +4,11 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
namespace Service_Server.DB
|
namespace Service_Server.DB
|
||||||
{
|
{
|
||||||
class Person_DB
|
public class Person_DB
|
||||||
{
|
{
|
||||||
public List<Person> GetAllPersons()
|
public List<Person> GetAllPersons()
|
||||||
{
|
{
|
||||||
|
|
|
@ -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<Result> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue