narsil/Tanshu.Accounts.SqlDAO/BusinessLayer/FoodTableBI.cs

51 lines
1.3 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Text;
using Tanshu.Accounts.Contracts;
using System.Data.SqlClient;
using Tanshu.Data.DAO;
using Tanshu.Accounts.Entities;
using Tanshu.Accounts.SqlDAO;
namespace Tanshu.Accounts.Repository
{
public class FoodTableBI
{
public void Insert(FoodTable foodTable)
{
using (var session = SessionManager.Session)
{
session.Save(foodTable);
}
}
public void Update(FoodTable foodTable)
{
using (var session = SessionManager.Session)
{
session.Update(foodTable);
}
}
public void Delete(int foodTableID)
{
using (var session = SessionManager.Session)
{
session.Delete(new FoodTable() { FoodTableID = foodTableID });
}
}
public FoodTable GetFoodTable(int foodTableID)
{
using (var session = SessionManager.Session)
{
return session.Get<FoodTable>(foodTableID);
}
}
public IList<FoodTable> GetFoodTables()
{
using (var session = SessionManager.Session)
{
return session.CreateCriteria<FoodTable>().List<FoodTable>();
}
}
}
}