public static async Task Add(ApplicationDbContext context, JGN_User_Settings entity) { if (entity.userid != null && entity.userid != "") { var _entity = new JGN_User_Settings() { userid = entity.userid }; context.Entry(_entity).State = EntityState.Added; await context.SaveChangesAsync(); } }
public static async Task Update(ApplicationDbContext context, JGN_User_Settings entity) { var item = await context.JGN_User_Settings .Where(p => p.userid == entity.userid) .FirstOrDefaultAsync(); if (item != null) { item.isemail = entity.isemail; item.issendmessages = entity.issendmessages; context.Entry(item).State = EntityState.Modified; await context.SaveChangesAsync(); } }