using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LC.DAL
{
using IDAL;
using Entity;
public class VIPUsersDAL : IVIPUsers
{
public int Add(VIPUsers t)
{
using (EFDbContext dbContext = new EFDbContext())
{
dbContext.Entry(t).State = System.Data.Entity.EntityState.Added;
var result = dbContext.SaveChanges();
return result;
}
}
public int Delete(int Id)
{
using (EFDbContext dbContext = new EFDbContext())
{
var t = dbContext.VIPUsers.Find(Id);
dbContext.Entry(t).State = System.Data.Entity.EntityState.Deleted;
var result = dbContext.SaveChanges();
return result;
}
}
public List<VIPUsers> Query()
{
using (EFDbContext dbContext = new EFDbContext())
{
var result = dbContext.VIPUsers.ToList();
return result;
}
}
public VIPUsers QueryById(int Id)
{
using (EFDbContext dbContext = new EFDbContext())
{
var result = dbContext.VIPUsers.Find(Id);
return result;
}
}
public int Update(VIPUsers t)
{
using (EFDbContext dbContext = new EFDbContext())
{
dbContext.Entry(t).State = System.Data.Entity.EntityState.Modified;
var result = dbContext.SaveChanges();
return result;
}
}
}
}