Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }