You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.5 KiB
55 lines
1.5 KiB
1 year ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Data.Entity.Migrations;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using System.Threading.Tasks;
|
||
|
using CK.SCP.Models;
|
||
|
using CK.SCP.Models.ScpEntity;
|
||
|
|
||
|
|
||
|
namespace CK.SCP.Controller
|
||
|
{
|
||
|
public class PublicDataController
|
||
|
{
|
||
|
public static TB_PublicData GetlistByBillNo(int id)
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
return db.TB_PublicData.SingleOrDefault(p => p.ID == id);
|
||
|
}
|
||
|
}
|
||
|
public static bool SaveInfo(TB_PublicData model)
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
db.TB_PublicData.AddOrUpdate(model);
|
||
|
db.SaveChanges();
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
|
||
|
public static bool UpdateInfo(TB_PublicData model)
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
db.TB_PublicData.AddOrUpdate(p => p.ID, model);
|
||
|
db.SaveChanges();
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public static void DeleteById(int id)
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
var info = db.TB_PublicData.SingleOrDefault(p => p.ID == id);
|
||
|
if (info != null) db.TB_PublicData.Remove(info);
|
||
|
db.SaveChanges();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|