public static bool Delete(ApplicationDbContext context, short objectid) { var entity = new JGN_RoleObjects { id = objectid }; context.JGN_RoleObjects.Attach(entity); context.JGN_RoleObjects.Remove(entity); return(true); }
public static async Task <JGN_RoleObjects> Add(ApplicationDbContext context, JGN_RoleObjects entity) { var _entity = new JGN_RoleObjects() { objectname = entity.objectname, description = entity.description, uniqueid = entity.uniqueid }; context.Entry(_entity).State = EntityState.Added; await context.SaveChangesAsync(); return(_entity); }
public static async Task <bool> Update_Record(ApplicationDbContext context, JGN_RoleObjects entity) { var item = await context.JGN_RoleObjects .Where(p => p.id == entity.id) .FirstOrDefaultAsync(); if (item != null) { item.objectname = UtilityBLL.processNull(entity.objectname, 0); item.description = UtilityBLL.processNull(entity.description, 0); context.Entry(item).State = EntityState.Modified; await context.SaveChangesAsync(); } return(true); }