2018-05-30 21:44:37 +02:00
|
|
|
|
using Service_Server.Models;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2018-06-01 15:36:25 +02:00
|
|
|
|
using System.Web;
|
2018-05-30 21:44:37 +02:00
|
|
|
|
|
|
|
|
|
namespace Service_Server.DB
|
|
|
|
|
{
|
2018-06-01 15:36:25 +02:00
|
|
|
|
public class PStatus_DB
|
2018-05-30 21:44:37 +02:00
|
|
|
|
{
|
|
|
|
|
public List<PStatus> GetAllPstatuses()
|
|
|
|
|
{
|
|
|
|
|
using (DATABASE ctx = new DATABASE())
|
|
|
|
|
{
|
|
|
|
|
return ctx.PStatuses.ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public bool CreatePstatus(PStatus pstatus)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
using (DATABASE ctx = new DATABASE())
|
|
|
|
|
{
|
|
|
|
|
ctx.PStatuses.Add(pstatus);
|
|
|
|
|
ctx.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool UpdatePstatus(PStatus pstatus)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
using (DATABASE ctx = new DATABASE())
|
|
|
|
|
{
|
|
|
|
|
ctx.PStatuses.Attach(pstatus);
|
|
|
|
|
ctx.Entry(pstatus).State = System.Data.Entity.EntityState.Modified;
|
|
|
|
|
ctx.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public bool DeletePstatus(PStatus pstatus)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
using (DATABASE ctx = new DATABASE())
|
|
|
|
|
{
|
|
|
|
|
ctx.PStatuses.Attach(pstatus);
|
|
|
|
|
ctx.PStatuses.Remove(pstatus);
|
|
|
|
|
ctx.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|