30 lines
797 B
C#
30 lines
797 B
C#
using Cowain.Preheat.Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.Entity;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Unity;
|
|
|
|
namespace Cowain.Preheat.BLL
|
|
{
|
|
public class RoleInfoService : ServiceBase
|
|
{
|
|
public RoleInfoService(IUnityContainer unityContainer) : base(unityContainer)
|
|
{
|
|
|
|
}
|
|
|
|
public int Update(TRoleInfo model)
|
|
{
|
|
using (var Context = new PreheatEntities())
|
|
{
|
|
Context.Set<TRoleInfo>().Attach(model);//将数据附加到上下文,支持实体修改和新实体,重置为UnChanged
|
|
Context.Entry<TRoleInfo>(model).State = EntityState.Modified;
|
|
return Context.SaveChanges();
|
|
}
|
|
}
|
|
}
|
|
}
|