public static void Delete(ApplicationDbContext context, int id) { if (id > 0) { var entity = new JGN_BlockIP { id = id }; context.JGN_BlockIP.Attach(entity); context.JGN_BlockIP.Remove(entity); context.SaveChanges(); } }
public static JGN_BlockIP Add_IP(ApplicationDbContext context, JGN_BlockIP entity) { var data = new JGN_BlockIP() { ipaddress = entity.ipaddress, created_at = DateTime.Now }; context.Entry(data).State = EntityState.Added; context.SaveChanges(); entity.id = data.id; return(entity); }