public static async Task <JGN_Attr_TemplateSections> Add(ApplicationDbContext context, JGN_Attr_TemplateSections entity) { var ent = new JGN_Attr_TemplateSections() { title = UtilityBLL.processNull(entity.title, 0), templateid = entity.templateid, priority = entity.priority, attr_type = entity.attr_type, showsection = entity.showsection }; context.Entry(ent).State = EntityState.Added; await context.SaveChangesAsync(); entity.id = ent.id; return(entity); }
public static async Task <bool> Update(ApplicationDbContext context, JGN_Attr_TemplateSections entity) { if (entity.id > 0) { var item = await context.JGN_Attr_TemplateSections .Where(p => p.id == entity.id) .FirstOrDefaultAsync(); if (item != null) { item.title = UtilityBLL.processNull(entity.title, 0); item.priority = entity.priority; item.showsection = entity.showsection; context.Entry(item).State = EntityState.Modified; await context.SaveChangesAsync(); } } return(true); }